ci: fix macOS build on GHA #35
Workflow file for this run
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: CI build | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
permissions: | |
contents: read | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
# Keep in mind: | |
# 60 seconds on Ubuntu = 1 minute charged to account | |
# 60 seconds on Windows = 2 minutes charged to account | |
# 60 seconds on macOS = 10 minutes charged to account | |
semver: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: 'npm' | |
node-version-file: '.nvmrc' | |
- run: npm ci | |
- name: Make local 'remote' for semantic-release | |
run: | | |
# semantic-release tracks channels with notes, so we need to grab those from the real remote | |
# semantic-release also wants to inspect every branch listed in its "branches" setting | |
git fetch -uf origin main:main develop:develop 'refs/notes/*:refs/notes/*' | |
git clone . --bare --mirror semantic-release-remote # mirror copies notes | |
git remote set-url origin "file://$(realpath semantic-release-remote)" # semantic-release needs a proper URL | |
- name: Stage semantic-release version commit | |
# In release branches, this will calculate the version and save that to package.json so the build can use it. | |
# In other branches, it'll just check the semantic-release config. | |
# Note that if semantic-release makes changes it will automatically push them. | |
# That's the whole reason for the weird "local remote" stuff. | |
# See also: https://github.com/semantic-release/semantic-release/issues/964 | |
run: npx --no -- semantic-release | |
- name: Create artifact for semantic-release 'remote' | |
run: tar czvf semantic-release-remote.tgz semantic-release-remote | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: semantic-release-remote | |
path: semantic-release-remote.tgz | |
retention-days: 1 # relevant if a failure prevents the delete step below | |
build: | |
needs: semver | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest] # [windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
#- name: Setup upterm session | |
# uses: lhotari/action-upterm@v1 | |
# with: | |
# limit-access-to-users: cwillisf | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: semantic-release-remote | |
path: . | |
- name: Restore semantic-release 'remote' | |
shell: bash | |
run: | | |
# this `tar` command replaces the usual "checkout" step | |
tar xzvf semantic-release-remote.tgz | |
rm semantic-release-remote.tgz | |
- name: Pull semantic-release changes from local 'remote' | |
shell: bash | |
run: | | |
git remote add semantic-release semantic-release-remote | |
git pull --tags semantic-release ${{ github.ref_name }} | |
git fetch semantic-release 'refs/notes/*:refs/notes/*' # semantic-release tracks channels with notes | |
- if: runner.os == 'macOS' | |
uses: ./.github/actions/macos-build | |
with: | |
configuration: Debug | |
artifact_tag: Debug | |
AC_USERNAME: ${{ secrets.AC_USERNAME }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
- if: runner.os == 'Windows' | |
uses: ./.github/actions/windows-build | |
with: | |
configuration: Debug | |
artifact_tag: Debug | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: Artifacts/ | |
finish: | |
if: always() # even if the build fails | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: semantic-release-remote | |
failOnError: false |