Update GitHub workflows tests #19
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: Deploy release candidate | |
on: | |
push: | |
branches: | |
- main | |
pull_request: # Runs on pull requests to any branch | |
env: | |
DFX_VERSION: 0.21.0 | |
NODE_VERSION: 20 | |
jobs: | |
get-tests: | |
if: ${{ contains(github.head_ref, 'release--') }} | |
name: Get tests | |
runs-on: ubuntu-latest | |
outputs: | |
tests: ${{ steps.get_tests.outputs.tests }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get all test dirs | |
id: get_tests | |
uses: ./.github/actions/get_tests | |
with: | |
directories: | | |
./examples | |
./tests | |
determine-should-release: | |
if: ${{ contains(github.head_ref, 'release--') }} | |
name: Determine if this branch should release | |
runs-on: ubuntu-latest | |
outputs: | |
should_release: ${{ steps.determine_should_release.outputs.should_release }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: determine_should_release | |
uses: ./.github/actions/should_release | |
release: | |
name: Deploy release | |
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested | |
if: ${{ !needs.determine-should-release.outputs.should_release }} | |
needs: | |
- get-tests | |
- determine-should-release | |
runs-on: ubuntu-latest | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref || github.ref }} | |
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: https://registry.npmjs.org | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Install dfx | |
run: | | |
DFXVM_INIT_YES=true DFX_VERSION=${{ env.DFX_VERSION }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH | |
# TODO we should use some Action-specific bot account | |
- name: Configure git for publishing release | |
run: | | |
git config --global user.name 'Jordan Last' | |
git config --global user.email '[email protected]' | |
git config --global commit.gpgsign true | |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import | |
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 | |
- name: Publish release | |
run: ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-tests.outputs.tests).*.path }} |