Install global dependencies #187
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: Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: # Runs on pull requests to any branch | |
jobs: | |
determine-should-release: | |
if: ${{ startsWith(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 | |
get-node-version: | |
needs: determine-should-release | |
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }} | |
name: Get node version | |
runs-on: ubuntu-latest | |
outputs: | |
node-version: ${{ steps.get-node-version.outputs.node-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-node-version | |
uses: ./.github/actions/get_node_version | |
- id: report | |
run: echo ${{steps.get-node-version.outputs.node-version}} | |
get-test-infos: | |
needs: | |
- determine-should-release | |
- get-node-version | |
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }} | |
name: Get test infos | |
runs-on: ubuntu-latest | |
outputs: | |
test-infos: ${{ steps.get-test-infos.outputs.test-infos }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get all test infos | |
id: get-test-infos | |
uses: ./.github/actions/get_test_infos | |
with: | |
node-version: ${{ needs.get-node-version.outputs.node-version }} | |
directories: | | |
./examples | |
./tests | |
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 == 'true' }} | |
needs: | |
- determine-should-release | |
- get-test-infos | |
- get-node-version | |
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: ${{ needs.get-node-version.outputs.node-version }} | |
registry-url: https://registry.npmjs.org | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Install curl | |
run: sudo apt-get install curl -y | |
- id: get-dfx-version | |
# TODO Hey Jordan, This is here to demonstrate two different ways of doing get node version and get dfx version. I think we should unify them, but I wanted to have both to see which you prefered | |
uses: ./.github/actions/get_dfx_version | |
- name: Install dfx | |
run: | | |
# Install dfx (Note: DFX must be installed before `npm install` because the azle instalation process required dfx) | |
# TODO if you want we could explore using the install script... it's kind of overkill and we would still have to supply the version. Though if dfinity ever changed their install script again it would be only one place we would have to update. This would apply to the installation in the test.yml as well | |
DFXVM_INIT_YES=true DFX_VERSION=${{ steps.get-dfx-version.outputs }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
- name: Install global dependencies | |
run: | | |
npx azle install-global-dependencies --rust --wasi2ic | |
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: | | |
BRANCH_NAME="${{ github.head_ref }}" | |
RELEASE_VERSION="${BRANCH_NAME:9}" | |
./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }} |