Giter Club home page Giter Club logo

latest-tag's Introduction

Latest tag

All Contributors

Automatically creates & updates a latest tag pointing to your latest release.

When using GitHub Actions you always have to put a reference for every action you use in your worflows: that means that you either need to choose a specific version or you need to use a branch. If you want to use the latest release of an action you can only hope authors are mantaining a latest tag that they update with every version: although not impossible, it's not that easy to find someone willing to do that.

That's why I made this action: if you're the kind of guy that doesn't like to update tags you can simply use this action and forget about it. You can just put latest in the documentation: your users will get the benefits of using a branch as ref and the security of using only stable versions (as long as you don't make breaking changes).

Usage

Add a step like this to your workflow:

- name: Run latest-tag
  uses: EndBug/latest-tag@latest
  with:
    # You can change the name of the tag or branch with this input.
    # Default: 'latest'
    ref: someCustomTagName

    # If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag.
    # Default: ''
    description: Description for the tag

    # Force-update a branch instead of using a tag.
    # Default: false
    force-branch: true

    # Directory to use when executing git commands
    # Default: '${{ github.workspace }}'
    git-directory: 'path/to/repo/dir'

Important

Please make sure to set the workflow permissions so that the action runs with the contents: write permission. Visit the GitHub docs to learn more about token permissions: "Automating token authentication"

License

This action is distributed under the MIT license, check the license for more info.

Similar actions

actions-tagger: allows you to create and update both latest and major version tags, even though it doesn't support annotated tags and the major version tag is mandatory (ref v2.0.1).

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Federico Grandi
Federico Grandi

💻 📖
Kslr
Kslr

💻
Lukáš Doležal
Lukáš Doležal

💻
ziyangczi
ziyangczi

🤔
James Smith
James Smith

🤔 💻
Sebastian Hoß
Sebastian Hoß

💻
Tyler Goffinet
Tyler Goffinet

💻
Alyssa
Alyssa

🐛
Pavel Faltýnek
Pavel Faltýnek

🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

latest-tag's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar docx avatar endbug avatar floppy avatar kslr avatar qubitz avatar sebhoss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

latest-tag's Issues

git push command failed

Hello,

I've started getting errors using the latest version of latest-tag. It looks like it's not getting the git authentication token, somehow. This started two days ago, and I don't think I've changed anything. Any ideas?

Last working build: https://github.com/davidgiven/fluxengine/runs/6862570739?check_suite_focus=true

Current failing build: https://github.com/davidgiven/fluxengine/runs/6907927259?check_suite_focus=true

Warning: Input 'tag-name' has been deprecated with message: Use the `ref` input instead
Run EndBug/latest-tag@latest
  with:
    tag-name: dev
    force-branch: false
  env:
    MSYSTEM: MINGW32
    RELEASE_DATE: 2022-06-15
    GITHUB_TOKEN: ***
  
Setting up git user...
Using 'dev' as tag name.
Creating lightweight tag...
Pushing updated tag to repo...
Error: Command failed: git push --force origin dev
fatal: Cannot prompt because user interactivity has been disabled.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com/': No such file or directory

Permission denied

When this workflow runs, I get Command failed: git push --force origin latest.

name: Add latest tag on release

on: [release]

jobs:
    add-tag:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - uses: EndBug/latest-tag@latest
              with:
                description: Points to the latest release
              env:
                GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Command failed: git config user.name <my user name> fatal: not in a git directory

I have the following configuration in my .github/workflows/create_latest_tag.yml file:

name: Latest Tag
on: push
jobs:
  Create-Latest-Tag:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - name: Run latest-tag
        uses: EndBug/latest-tag@latest
        with:
          # You can change the name of the tag or branch with this input.
          # Default: 'latest'
          ref: latest

          # If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag.
          # Default: ''
          description: We always set the "latest" tag to the last commit in the main branch

          # Force-update a branch instead of using a tag.
          # Default: false
          force-branch: false

When pushing a commit to the main branch, the action fails with the following error:

Run EndBug/latest-tag@latest
  with:
    ref: latest
    description: We always set the "latest" tag to the last commit in the main branch
    force-branch: false
Setting up git user...
Error: Command failed: git config user.name "StephanMertel"
fatal: not in a git directory

"Committer identity unknown" error on v1.6.0

The v1.6.0 release of this action has broken for us with an error about user config. We've pinned to v1.5.1 for the time being as a workaround. It's a private repo, but happy to share any other details that would be useful.

We're using self-hosted runners for our pipeline - not sure if that's relevant but the auto-detected email address ('runner@ks-1cpu-1gi-v56-bxd79-bh2nj.(none)) is the user and name of the pod running the job.

Our config is:

- name: Create tag
  uses: EndBug/[email protected]
  with:
    ref: '${{ needs.prepare.outputs.VERSION }}'
    description: '${{ needs.prepare.outputs.VERSION }}'

v1.5.1 output (working):

Run EndBug/[email protected]
  with:
    ref: 2.1.5601.2377
    description: 2.1.5601.2377
    force-branch: false
Setting up git user...
Using '2.1.5601.2377' as tag name.
Creating annotated tag...
Pushing updated tag to repo...
To https://github.com/glean-notes/glean
 * [new tag]         2.1.5601.2377 -> 2.1.5601.2377

v1.6.0 output (not working):

Run EndBug/latest-tag@latest
  with:
    ref: 2.1.5601.1720
    description: 2.1.5601.1720
    force-branch: false
    git-directory: /runner/_work/glean/glean

Running git commands within /runner/_work/glean/glean
Using '2.1.5601.1720' as tag name.
Setting up git user...
Creating annotated tag...
Error: Command failed: git -C /runner/_work/glean/glean tag -a -f -m "2.1.5601.1720" 2.1.5601.1720
Committer identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'runner@ks-1cpu-1gi-v56-bxd79-bh2nj.(none)')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.