diff --git a/.github/actions/determine_workflow_config/action.yml b/.github/actions/determine_workflow_config/action.yml index aa4e8f1b42..aef7a6dd1a 100644 --- a/.github/actions/determine_workflow_config/action.yml +++ b/.github/actions/determine_workflow_config/action.yml @@ -38,6 +38,9 @@ outputs: fuzz: description: 'Whether to run fuzz tests' value: ${{ steps.determine_workflow_config.outputs.fuzz }} + is-dependabot: + description: 'Whether the commit is from Dependabot' + value: ${{ steps.determine_workflow_config.outputs.is-dependabot }} runs: using: 'composite' @@ -54,6 +57,7 @@ runs: echo "exclude-release-only=${{ inputs.exclude-release-only-dispatch-input-value }}" >> $GITHUB_OUTPUT echo "link-azle=${{ inputs.link-azle-dispatch-input-value }}" >> $GITHUB_OUTPUT echo "fuzz=${{ inputs.fuzz-dispatch-input-value }}" >> $GITHUB_OUTPUT + echo "is-dependabot=false" >> $GITHUB_OUTPUT else EXCLUDE_SLOW=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' }} EXCLUDE_UNSTABLE=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' }} @@ -69,6 +73,8 @@ runs: echo "link-azle=true" >> $GITHUB_OUTPUT fi echo "fuzz=false" >> $GITHUB_OUTPUT + echo ${{ github.actor }} + echo "is-dependabot=${{ github.actor == 'dependabot[bot]' }}" >> $GITHUB_OUTPUT fi - id: echo-outputs @@ -80,3 +86,4 @@ runs: echo "exclude-release-only: ${{ steps.determine_workflow_config.outputs.exclude-release-only }}" echo "link-azle: ${{ steps.determine_workflow_config.outputs.link-azle }}" echo "fuzz: ${{ steps.determine_workflow_config.outputs.fuzz }}" + echo "is-dependabot: ${{ steps.determine_workflow_config.outputs.is-dependabot }}" diff --git a/.github/workflows/build_templates.yml b/.github/workflows/build_templates.yml new file mode 100644 index 0000000000..da630e8d18 --- /dev/null +++ b/.github/workflows/build_templates.yml @@ -0,0 +1,60 @@ +name: Build Templates + +on: + pull_request: + types: + - opened + - synchronize + - ready_for_review + - reopened + +jobs: + workflow-config: + name: Determine workflow config + runs-on: ubuntu-latest + outputs: + is-dependabot: ${{ steps.determine-workflow-config.outputs.is-dependabot }} + steps: + - uses: actions/checkout@v4 + + - id: determine-workflow-config + uses: ./.github/actions/determine_workflow_config + with: + is-workflow-dispatch: false + exclude-slow-dispatch-input-value: false + exclude-unstable-dispatch-input-value: false + exclude-release-only-dispatch-input-value: false + link-azle-dispatch-input-value: false + + build-templates: + name: Build templates for Dependabot + needs: workflow-config + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + - uses: ./.github/actions/setup_node + + - uses: ./.github/actions/setup_dfx + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + - name: Build stable template + run: AZLE_VERBOSE=true npx azle template + + - name: Build experimental template + run: AZLE_VERBOSE=true npx azle template --experimental + + - uses: ./.github/actions/commit_and_push + with: + branch-name: ${{ github.head_ref }} + commit-message: 'chore: update templates for dependency changes' + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}