Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven release workflow doesn't trigger on new tag worklow #537

Open
mohamed-ennahdi opened this issue Nov 28, 2024 · 0 comments
Open

Maven release workflow doesn't trigger on new tag worklow #537

mohamed-ennahdi opened this issue Nov 28, 2024 · 0 comments

Comments

@mohamed-ennahdi
Copy link

I have 2 workflows:

  • a maven release workflow, triggered by workflow_dispatch
  • a docker image creation supposed to be triggered by the aforementioned workflow (when a new tag is pushed)

I shouldn't use GITHUB_TOKEN when expecting a workflow to call another workflow, that's why I made my own Personal Access Token (PAS) and passed it in the first workflow (secrets.PAS_TOKEN).

Am I correctly using the PAS token with the Maven command ?

The release goal executed by maven pushes new tags indeed.

As a matter of fact, workflow_run is pointless as it does not work with tags.

The maven release workflow YAML:

name: Java CI with Maven to release latest SNAPSHOT version

on:
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK 17
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'temurin'
        cache: maven
    - name: Configure Git user
      run: |
        git config user.email "[email protected]"
        git config user.name "Mohamed Ennahdi El Idrissi"
    - name: Build with Maven
      run: mvn -B release:clean release:prepare release:perform --file pom.xml
      env:
        GITHUB_TOKEN: ${{ secrets.PAS_TOKEN }}

The docker image creation workflow YAML:

name: Java CI with Maven to create and publish Docker image

on:
  push:
    tags:
    - '*'
    
jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK 17
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'temurin'
        cache: maven
    - name: Create docker image and push to docker hub (latest version)
      run: |
        echo $RELEASE_VERSION
        echo ${{ env.RELEASE_VERSION }}
        mvn -B spring-boot:build-image --file pom.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant