ignore first commit (#116) #211
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 | |
concurrency: | |
group: environment-${{ github.head_ref || github.ref }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
set_vars: | |
runs-on: ubuntu-latest | |
outputs: | |
site_matrix: ${{ steps.set_vars.outputs.site_matrix }} | |
is_first_commit: ${{ steps.check_first_commit.outputs.is_first_commit }} | |
steps: | |
- name: Set site matrix | |
id: set_vars | |
shell: bash | |
run: | | |
if [ -z ${{ vars.SITES }} ]; then | |
echo "site_matrix={site: [\"${{ github.event.repository.name }}\"] }" >> $GITHUB_OUTPUT | |
else | |
echo "site_matrix={site: ${{ vars.SITES }} }" >> $GITHUB_OUTPUT | |
fi | |
- name: Check if it's the first commit | |
id: check_first_commit | |
run: | | |
if [ "$(git rev-list --count HEAD)" = "1" ]; then | |
echo "is_first_commit=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_first_commit=false" >> $GITHUB_OUTPUT | |
fi | |
deploy: | |
needs: set_vars | |
if: needs.set_vars.outputs.is_first_commit == 'false' | |
strategy: | |
matrix: ${{ fromJson(needs.set_vars.outputs.site_matrix) }} | |
name: Deploy | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 # Set your desired timeout for this job | |
permissions: | |
id-token: write # Needed for auth with Deno Deploy | |
contents: read # Needed to clone the repository | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Deco Deploy | |
id: decoDeployStep | |
continue-on-error: true | |
uses: deco-cx/deploy@v0 | |
with: | |
site: ${{ matrix.site }} | |
- name: Retry Deco Deploy | |
id: decoDeployRetryStep | |
if: steps.decoDeployStep.outcome == 'failure' | |
uses: deco-cx/deploy@v0 | |
with: | |
site: ${{ matrix.site }} |