Skip to content

Commit

Permalink
ci(chore): use env var instead of prefix v
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Mannocci <[email protected]>
  • Loading branch information
amannocci committed Mar 22, 2024
1 parent 5d5617e commit e151fba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/pre-post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ on:

env:
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_VERSION_TAG: v${{ inputs.version }}
BRANCH_NAME: ${{ inputs.phase }}-release-v${{ inputs.version }}

permissions:
contents: read

Expand All @@ -37,7 +38,7 @@ jobs:
- name: Validate release tag does not exist in repo
uses: ./.github/workflows/validate-tag
with:
tag: v${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION_TAG }}

create-pr:
name: "Bump versions and create PR"
Expand Down Expand Up @@ -67,8 +68,8 @@ jobs:
- name: Create the release tag (post phase)
if: inputs.phase == 'post'
run: |
git tag "v${{ env.RELEASE_VERSION }}"
git push origin "v${{ env.RELEASE_VERSION }}"
git tag "${{ env.RELEASE_VERSION_TAG }}"
git push origin "${{ env.RELEASE_VERSION_TAG }}"
- name: Create a ${{ inputs.phase }} release branch
run: git checkout -b ${{ env.BRANCH_NAME }}
Expand All @@ -88,10 +89,10 @@ jobs:
- name: Push the ${{ inputs.phase }} release branch
run: |
git add --all
git commit -m "${{ inputs.phase }} release: elastic-apm-agent v${{ env.RELEASE_VERSION }}"
git commit -m "${{ inputs.phase }} release: elastic-apm-agent ${{ env.RELEASE_VERSION_TAG }}"
git push origin ${{ env.BRANCH_NAME }}
- name: Create the ${{ inputs.phase }} release PR
run: gh pr create --title="${{ inputs.phase }} release v${{ env.RELEASE_VERSION }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.phase }} release v${{ env.RELEASE_VERSION }}"
run: gh pr create --title="${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.phase }} release ${{ env.RELEASE_VERSION_TAG }}"
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ concurrency:

env:
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_VERSION_TAG: v${{ inputs.version }}

jobs:
validate-tag:
Expand All @@ -53,7 +54,7 @@ jobs:
- name: Validate tag does not exist on current commit
uses: ./.github/workflows/validate-tag
with:
tag: v${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION_TAG }}
- name: Validate tag match current version
run: |
if [ "$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout)" != "${{ env.RELEASE_VERSION }}" ]; then
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:
with:
groupid: 'co.elastic.apm'
artifactid: 'elastic-apm-agent'
version: ${{ inputs.version }}
version: ${{ env.RELEASE_VERSION }}

update-major-branch:
name: "Update Major Branch"
Expand Down Expand Up @@ -247,7 +248,7 @@ jobs:
if: inputs.dry_run == false
with:
ref: ${{ inputs.ref }}
version: ${{ inputs.version }}
version: ${{ env.RELEASE_VERSION }}
phase: 'post'
secrets: inherit

Expand Down

0 comments on commit e151fba

Please sign in to comment.