From 9329fec38ec893b1e03c31417d65433c354f95b7 Mon Sep 17 00:00:00 2001 From: Bart van Beusekom Date: Mon, 29 Jan 2024 14:17:42 +0100 Subject: [PATCH] Update release pipeline - there were issues in updating version --- .github/workflows/deploy.yaml | 58 +++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8695625f..c162e897 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -42,21 +42,10 @@ jobs: if [[ $MAJOR == '3' ]]; then MAJOR_NAME="petronas"; fi echo "major_name=${MAJOR_NAME}" >> $GITHUB_OUTPUT - outputs: - version: ${{ steps.split.outputs.version }} - stage: ${{ steps.split.outputs.stage }} - major_name: ${{ steps.split.outputs.major_name }} - - # Build artifact for deployment - build: - name: Build deployment artifact - runs-on: ubuntu-latest - needs: version - env: - version: ${{ needs.version.outputs.version }} - - steps: - - uses: actions/checkout@v3 + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Get branch on which the tag is based id: branchname @@ -67,17 +56,22 @@ jobs: branch=$(echo $raw | sed 's/.*origin\///') echo "branch=${branch}" >> $GITHUB_OUTPUT + - name: Checkout branch on which tag was pushed + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ env.branch }} + token: ${{ secrets.COMMIT_PAT }} + - name: Update UI version in package.json + env: + version: ${{ steps.split.outputs.version }} run: | npm version --no-git-tag-version --allow-same-version $version - - name: Set up Node.js version - uses: actions/setup-node@v1 - with: - node-version: "20.x" - - name: Commit updated version env: + version: ${{ steps.split.outputs.version }} branch: ${{ steps.branchname.outputs.branch }} run: | git config --local user.name github-actions @@ -85,6 +79,30 @@ jobs: git add * git commit -m "Updated the version to ${version}" git push origin HEAD:$branch + outputs: + version: ${{ steps.split.outputs.version }} + stage: ${{ steps.split.outputs.stage }} + major_name: ${{ steps.split.outputs.major_name }} + branch: ${{ steps.branchname.outputs.branch }} + + # Build artifact for deployment + build: + name: Build deployment artifact + runs-on: ubuntu-latest + needs: version + env: + version: ${{ needs.version.outputs.version }} + branch: ${{ needs.version.outputs.branch }} + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{env.branch}} + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: "20.x" - name: npm install, build, and test run: |