Skip to content

Commit

Permalink
ci: fix release pipeline (#744)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan-Niklas <[email protected]>
Co-authored-by: Jan-Niklas <[email protected]>
(cherry picked from commit b1d7ea8)
  • Loading branch information
BenPag authored and janivo committed Sep 20, 2022
1 parent 7a682d6 commit 477f2cc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/deploy-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@ name: 'Publish Release & Deploy'
## The version is available at elements.inovex.de/version/<TAG-NAME>

on:
workflow_run:
workflows: [ "Test & Build" ]
types: [completed]
branches: [master]
pull_request:
types:
- closed
branches:
- master

jobs:
build:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'release')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/dependencies-install
- run: npm config set scripts-prepend-node-path true
- run: yarn build
- name: Upload all build artifacts
uses: ./.github/workflows/artifacts-upload
with:
upload-core-artifacts: true
upload-storybook-artifact: true

tag_and_release:
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.head_commit.message, format('chore{0} publish v', ':')) }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Create version tag
Expand All @@ -27,28 +42,25 @@ jobs:
body: ${{ steps.tag_version.outputs.changelog }}

publish:
needs:
- tag_and_release
needs: tag_and_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/dependencies-install
- uses: ./.github/workflows/artifacts-download
with:
workflow-id: ${{ github.event.workflow_run.workflow_id }}
download-core-artifacts: true
- name: Prepare git config
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor}}@users.noreply.github.com"
- run: yarn run publish:ci
- run: yarn publish:ci
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

deploy:
needs:
- publish
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -59,7 +71,6 @@ jobs:
- name: Download Storybook artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: storybook
path: version/${{ env.GITHUB_REF_NAME_SLUG }} # Push to the proper directory on gh pages branch.
- name: Provide latest symlink
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
canary-release:
if: ${{ github.event.workflow_run.conclusion == 'success' && !(startsWith(github.event.head_commit.message, format('chore{0} v', ':')) && endsWith(github.event.head_commit.message, ' publish')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"yes": true,
"push": false,
"message": "chore: publish %s",
"allowBranch": ["master", "elements-release-*"]
"allowBranch": [
"master"
]
}
}
}

0 comments on commit 477f2cc

Please sign in to comment.