build: quality gate runs even on skipped jobs (#4489) #454
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: changesets | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
- '*.*.*' | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
environment: | |
name: npm | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
published-packages: ${{ steps.changesets.outputs.publishedPackages }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4 | |
with: | |
node-version: lts/* | |
- name: Install Dependencies | |
run: yarn | |
- name: Configure git | |
run: | | |
git config --global user.name 'Neo4j Team GraphQL' | |
git config --global user.email '[email protected]' | |
- name: Creating .npmrc | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
@neo4j:registry https://registry.npmjs.org | |
//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
EOF | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create release PR or release | |
id: changesets | |
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5 | |
with: | |
title: changesets for branch `${{ github.ref_name }}` | |
version: yarn changeset-version-${{ github.ref_name }} | |
publish: yarn release | |
setupGitUser: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.NEO4J_TEAM_GRAPHQL_PERSONAL_ACCESS_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
slack-notify: | |
needs: | |
- release | |
if: ${{ needs.release.outputs.published == 'true' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: ${{ fromJson(needs.release.outputs.published-packages) }} | |
steps: | |
- name: Send Slack announcement of release | |
if: matrix.package.name == '@neo4j/graphql' | |
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 | |
with: | |
payload: '{"version":"${{ matrix.package.version }}"}' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_ANNOUNCEMENT_WEBHOOK_URL }} | |
# If a normal release off dev was done, we need to merge into master | |
merge-dev-into-master: | |
needs: | |
- release | |
if: ${{ github.ref_name == 'dev' && needs.release.outputs.published == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
ref: master | |
fetch-depth: 0 | |
token: ${{ secrets.NEO4J_TEAM_GRAPHQL_PERSONAL_ACCESS_TOKEN }} | |
- name: Configure git | |
run: | | |
git config --global user.name 'Neo4j Team GraphQL' | |
git config --global user.email '[email protected]' | |
- name: Merge into master if publish happens | |
if: needs.release.outputs.published == 'true' | |
run: | | |
git merge --no-ff origin/dev --strategy-option theirs | |
git push | |
# If a hotfix off master was done, we need to merge into dev | |
merge-master-into-dev: | |
needs: | |
- release | |
if: ${{ github.ref_name == 'master' && needs.release.outputs.published == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Create release branch for merging into dev | |
if: needs.release.outputs.published == 'true' | |
uses: peterjgrainger/action-create-branch@08259812c8ebdbf1973747f9297e332fa078d3c1 # v2.4.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.NEO4J_TEAM_GRAPHQL_PERSONAL_ACCESS_TOKEN }} | |
with: | |
branch: "release/${{ github.sha }}" | |
- name: pull-request | |
if: needs.release.outputs.published == 'true' | |
uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5 # v2.12.1 | |
with: | |
source_branch: "release/${{ github.sha }}" | |
destination_branch: "dev" | |
pr_title: "Merge ${{ github.ref_name }} into dev" | |
github_token: ${{ secrets.NEO4J_TEAM_GRAPHQL_PERSONAL_ACCESS_TOKEN }} |