Home > Software engineering >  Versions and Tags Not Being Created Properly on Github
Versions and Tags Not Being Created Properly on Github

Time:12-24

I have modified the Github workflow on a practice app to make it change version and patch with every push to the master branch.

In Github workflows - it says this process has been successful:

enter image description here

However when I check under releases and tags - no releases or tags are listed.

Is there something I'm missing, here is my pipeline.yml

    name: Deployment pipeline

on:
  push:
    branches:
      - master
  pull_request:
    branches: [master]
    types: [opened, synchronize]
jobs:
  simple_deployment_pipeline:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '16'
      - name: npm install 
        run: npm install  
      - name: lint
        run: npm run eslint
      - name: build
        run: npm run build
      - name: test
        run: npm run test
      - name: e2e tests
        uses: cypress-io/github-action@v4
        with:
          build: npm run 
          start: npm run start-prod
          wait-on: http://localhost:5000      
  tag_release:
    needs: [simple_deployment_pipeline]
    runs-on: ubuntu-20.04
    steps:
    - name: Bump version and push tag
      uses: anothrNick/[email protected]
      if: ${{ github.event_name == 'push'   && !contains(join(github.event.commits.*.message, ' '), '#skip') }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        DEFAULT_BUMP: patch
        RELEASE_BRANCHES: master

The log under tag_release looks like this:

enter image description here

CodePudding user response:

  1. Your problem, which can be inferred by the error message, is that you haven't checked out the code inside the job. This is noted in the readme of the dependent action.
name: Bump version
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: '0'

    - name: Bump version and push tag
      uses: anothrNick/github-tag-action@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This is a common mistake, many assume that the code should exist in the job by default, but once you get varying type of workflows you will understand some use cases where you don't actually need to checkout the local git repo.

  1. Take a look at the action you are using and consider sticking to the @v1 tag or at the very least pick a more recent version (1.36 is over a year old).
  • Related