diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..27d4a9c --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,26 @@ +name: Build (main) + +on: + push: + branches: [main] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + uses: ./.github/workflows/build.yml + + deploy-pages: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8594f8..a297438 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,15 +2,10 @@ name: Build on: push: + branches: ['*', '!main'] workflow_dispatch: workflow_call: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - jobs: build: strategy: @@ -31,6 +26,7 @@ jobs: if: runner.os == 'macOS' # Upload build artifacts to site + # Deploy happens in the `deploy-site` workflow, which only runs on main - run: | mkdir -p .build/site/ci cp .build/coverage.svg .build/coverage.html .build/site/ci @@ -55,14 +51,3 @@ jobs: # run: | # $Env:Path += ";" + (swift build --show-bin-path) # echo "test" | age --encrypt --recipient age1se1qgg72x2qfk9wg3wh0qg9u0v7l5dkq4jx69fv80p6wdus3ftg6flwg5dz2dp -o secret.txt.age - - deploy-pages: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1