Merge pull request #617 from Tradeshift/DEVOPS1-286 #248
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: 'master' | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
outputs: | |
needs-update: ${{ steps.diff.outcome != 'success' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
npm- | |
- run: | | |
npm ci | |
npm run build | |
npm run format-check | |
npm run lint | |
npm run package | |
npm run test | |
- name: Check for changes (fail if we forgot to update dist) | |
run: git diff --quiet dist | |
id: diff | |
continue-on-error: true | |
- name: Set up commit signing w/ GPG | |
if: ${{ steps.diff.outcome != 'success' }} | |
id: configure | |
uses: tradeshift/actions-git/configure-from-gpg-key@v1 | |
with: | |
gpg-key: ${{ secrets.TRADESHIFTCI_GPG_KEY }} | |
- name: PR build changes if needed | |
uses: tradeshift/create-pull-request@v7 | |
if: ${{ steps.diff.outcome != 'success' }} | |
with: | |
commit-message: "build: update dist folder" | |
branch: release-update-dist | |
title: "Update for release: update package runtime" | |
body: | | |
This PR is created automatically because the repo has been changed | |
without updating the packaged version in the `dist` folder. | |
Before these changes can be released, the `dist` folder has to be | |
updated. By merging this when the build is green, a new release | |
will be created based on the list of changes since the last release. | |
For more info see [semantic-release.gitbook.io/semantic-release/](https://semantic-release.gitbook.io/semantic-release/) | |
token: ${{ secrets.GH_TOKEN }} | |
committer: ${{ steps.configure.outputs.user }} | |
author: ${{ steps.configure.outputs.user }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: ${{ needs.build.outputs.needs-update != 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: tradeshift/actions-semantic-release@v2 | |
id: semantic-release | |
with: | |
check_name: Semantic release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Action tags (major version tag) | |
if: ${{ steps.semantic-release.outputs.new_release_published }} | |
run: | | |
git tag -f v${{ steps.semantic-release.outputs.new_release_major_version }} | |
git push -f origin v${{ steps.semantic-release.outputs.new_release_major_version }} |