-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2161 from demergent-labs/parallel_release
Parallel release
- Loading branch information
Showing
14 changed files
with
323 additions
and
191 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Prerequisite | ||
|
||
This action assumes that the repository has already been checked out before | ||
calling the action, typically using `actions/checkout@v4`. If you have not | ||
checked out the code in a previous step, make sure to do so to avoid errors. | ||
|
||
This action does **not** perform a checkout action itself because it would be | ||
redundant. This action is part of the repository's codebase, so if the code | ||
hasn't already been checked out, the action itself wouldn't even be available to | ||
call. | ||
|
||
## Example Usage | ||
|
||
```yaml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ./.github/actions/configure_git | ||
with: | ||
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Configure Git | ||
description: 'Configures git with user info and GPG signing' | ||
inputs: | ||
gpg_signing_key: | ||
description: 'The GPG signing key to use for signing commits' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Configure git | ||
run: | | ||
# TODO we should use some Action-specific bot account | ||
git config --global user.name 'Jordan Last' | ||
git config --global user.email '[email protected]' | ||
git config --global commit.gpgsign true | ||
echo -n "${{ inputs.gpg_signing_key }}" | base64 --decode | gpg --import | ||
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0 | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Setup dfx | ||
description: 'Sets up dfx by detecting version from package.json and installing it. (Note: DFX must be installed before `npm install` because the azle installation process requires dfx)' | ||
outputs: | ||
dfx-version: | ||
description: 'The version of dfx that was installed' | ||
value: ${{ steps.get-dfx-version.outputs.dfx-version }} | ||
runs: | ||
using: composite | ||
steps: | ||
- id: get-dfx-version | ||
run: | | ||
DFX_VERSION=$(jq -r '.azle.globalDependencies.dfx // error("dfx version not found")' "package.json") | ||
echo "dfx-version=${DFX_VERSION}" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
||
- name: Install dfx | ||
run: | | ||
# Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) | ||
src/build/stable/commands/install_global_dependencies/install_dfx.sh "${{ steps.get-dfx-version.outputs.dfx-version }}" | ||
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH | ||
shell: bash |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: 'Setup Node.js' | ||
description: 'Sets up Node.js environment and gets Node version from package.json' | ||
inputs: | ||
node-auth-token: | ||
description: 'NPM authentication token' | ||
required: false | ||
registry-url: | ||
description: 'NPM registry URL' | ||
required: false | ||
outputs: | ||
node-version: | ||
description: 'The Node.js version from package.json' | ||
value: ${{ steps.get-version.outputs.version }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- id: get-version | ||
shell: bash | ||
run: | | ||
VERSION=$(jq -r '.azle.globalDependencies.node // error("node version not found")' "package.json") | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: ${{ inputs.registry-url }} | ||
node-version: ${{ steps.get-version.outputs.version }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.node-auth-token }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
pull_request: # Runs on pull requests to any branch | ||
pull_request: | ||
|
||
jobs: | ||
determine-should-release: | ||
if: ${{ startsWith(github.head_ref, 'release--') }} | ||
|
@@ -17,84 +18,17 @@ jobs: | |
- id: determine-should-release | ||
uses: ./.github/actions/should_release | ||
|
||
get-test-infos: | ||
needs: determine-should-release | ||
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 | ||
|
||
- id: get-node-version | ||
uses: ./.github/actions/get_node_version | ||
|
||
- name: Get all test infos | ||
id: get-test-infos | ||
uses: ./.github/actions/get_test_infos | ||
with: | ||
node-version: ${{ steps.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 | ||
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 }} | ||
|
||
- id: get-node-version | ||
uses: ./.github/actions/get_node_version | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ steps.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 | ||
uses: ./.github/actions/get_dfx_version | ||
|
||
- name: Install dfx | ||
run: | | ||
# Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx) | ||
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }} | ||
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH | ||
- run: npm install | ||
|
||
- name: Install global dependencies | ||
run: | | ||
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic | ||
# 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) }} | ||
uses: ./.github/workflows/release_parallel.yml | ||
secrets: | ||
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} |
Oops, something went wrong.