From 09bdbf63ac4fad17172cf53c890161ce7dd335a1 Mon Sep 17 00:00:00 2001 From: Peter Skopek Date: Tue, 3 Sep 2024 14:18:50 +0200 Subject: [PATCH] GitHub Actions workflows tweaks Signed-off-by: Peter Skopek --- .github/workflows/release.yml | 44 ++++++++++----------- .github/workflows/x-create-tags.yml | 51 ------------------------- .github/workflows/x-env.yml | 29 -------------- .github/workflows/x-keycloak-client.yml | 5 +-- 4 files changed, 23 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/x-create-tags.yml delete mode 100644 .github/workflows/x-env.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce00995..606001d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,45 +22,45 @@ defaults: jobs: - show-inputs: + repo-prep: + name: Prepare repository runs-on: ubuntu-latest steps: - - run: | + - name: Show-inputs + run: | echo "Version: ${{ inputs.version }} " >> $GITHUB_STEP_SUMMARY echo "Release branch: ${{ inputs.branch }} " >> $GITHUB_STEP_SUMMARY echo "Workflow branch: ${{ github.ref_name }} " >> $GITHUB_STEP_SUMMARY echo "Deploy skip: ${{ inputs.deploy-skip }} " >> $GITHUB_STEP_SUMMARY - - name: Checkout repository + - name: Checkout uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} - - env: - uses: ./.github/workflows/x-env.yml - - create-tags: - name: Create tags - needs: [env] - uses: ./.github/workflows/x-create-tags.yml - with: - tag: ${{ github.event.inputs.version }} - branch: ${{ github.event.inputs.branch }} - set-versions: true - secrets: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Maven environment setup + run: | + cat $GITHUB_WORKSPACE/.github/env/release-env | sed -r '/^\s*$/d' >> $GITHUB_ENV + - name: Create version change commit + run: | + ./set-version.sh ${{ inputs.version }} + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git commit -a -m "Set version to ${{ inputs.version }}" + - name: Create tag commit + run: git tag --force ${{ inputs.version }} + - name: Push tag with version changes + run: git push --force origin refs/tags/${{ inputs.version }} keycloak-client: name: Keycloak Client - needs: [env, create-tags] + if: ${{ !inputs.deploy-skip }} + needs: repo-prep uses: ./.github/workflows/x-keycloak-client.yml with: mvn-url: ${{ needs.env.outputs.mvn-releases-url }} - tag: ${{ github.event.inputs.version }} - deploy-skip: ${{ needs.env.outputs.deploy-skip }} + tag: ${{ inputs.version }} + deploy-skip: ${{ inputs.deploy-skip }} secrets: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} MVN_USERNAME: ${{ secrets.MVN_USERNAME }} MVN_TOKEN: ${{ secrets.MVN_TOKEN }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - diff --git a/.github/workflows/x-create-tags.yml b/.github/workflows/x-create-tags.yml deleted file mode 100644 index bbe9d2b..0000000 --- a/.github/workflows/x-create-tags.yml +++ /dev/null @@ -1,51 +0,0 @@ - -name: X Create tags - -on: - workflow_call: - inputs: - tag: - required: true - type: string - branch: - required: false - type: string - default: main - set-versions: - required: false - type: boolean - default: false - secrets: - GH_TOKEN: - required: true - -defaults: - run: - shell: bash - -jobs: - create-tags: - runs-on: ubuntu-latest - - steps: - - name: Create version commit - if: inputs.set-versions - run: | - ./set-version.sh ${{ inputs.tag }} - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" - git commit -a -m "Set version to ${{ inputs.tag }}" - - - name: Tag commit - run: git tag --force ${{ inputs.tag }} - - - name: Push changes - run: git push --force origin refs/tags/${{ inputs.tag }} - - show-tags: - name: Show Git tags - runs-on: ubuntu-latest - needs: [create-tags] - steps: - - run: | - echo "https://github.com/keycloak/keycloak-client/tree/${{ inputs.tag }} " >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/x-env.yml b/.github/workflows/x-env.yml deleted file mode 100644 index ce87ed9..0000000 --- a/.github/workflows/x-env.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: X Environment setup - -on: - workflow_call: - outputs: - mvn-releases-url: - description: "Maven Releases URL" - value: ${{ jobs.env.outputs.mvn-releases-url }} - mvn-snapshots-url: - description: "Maven Snapshots URL" - value: ${{ jobs.env.outputs.mvn-snapshots-url }} - deploy-skip: - value: ${{ jobs.env.outputs.depoly-skip }} - -defaults: - run: - shell: bash - -jobs: - env: - runs-on: ubuntu-latest - outputs: - mvn-releases-url: ${{ env.mvn-releases-url }} - mvn-snapshots-url: ${{ env.mvn-snapshots-url }} - deploy-skip: ${{ env.deploy-skip }} - steps: - - id: load-env - run: | - cat .github/env/release-env | sed -r '/^\s*$/d' >> $GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/x-keycloak-client.yml b/.github/workflows/x-keycloak-client.yml index 9c4a433..44d1d86 100644 --- a/.github/workflows/x-keycloak-client.yml +++ b/.github/workflows/x-keycloak-client.yml @@ -17,13 +17,11 @@ on: type: string default: false path-final: - description: "Patch where the final tag will be checked out" + description: "Path where the final tag will be checked out" required: false type: string default: keycloak-client-final secrets: - GH_TOKEN: - required: true MVN_USERNAME: required: true MVN_TOKEN: @@ -49,7 +47,6 @@ jobs: java-version: 17 server-id: kc-rel-repository server-username: MAVEN_USERNAME - server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} gpg-passphrase: MAVEN_GPG_PASSPHRASE