feat: elements #314
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: Coverage Preview Deploy | |
on: | |
# When a PR is merged (or force push to main) | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
- labeled | |
- unlabeled | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pull-requests: write | |
concurrency: preview-cov-${{ github.ref }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# -=-=-=-= Create report =-=-=-=- | |
- uses: cachix/install-nix-action@v27 | |
if: | | |
(github.event.action == 'labeled' && github.event.label.name == 'coverage') || | |
(github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage')) | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: cachix/cachix-action@v14 | |
if: | | |
(github.event.action == 'labeled' && github.event.label.name == 'coverage') || | |
(github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage')) | |
with: | |
name: dlr-ft | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
- name: Generate report(s) | |
if: | | |
(github.event.action == 'labeled' && github.event.label.name == 'coverage') || | |
(github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage')) | |
run: nix build .#report --print-build-logs | |
# -=-=-=-= Deploy (when labeled) =-=-=-=- | |
- name: Deploy Preview (labeled) | |
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'coverage' }} | |
uses: rossjrw/[email protected] | |
with: | |
source-dir: result/coverage/html/ | |
umbrella-dir: coverage/pr-preview | |
action: deploy # force deployment since, by default, this actions does nothing on the 'labeled' event | |
# -=-=-=-= Deploy (when unlabeled) =-=-=-=- | |
- name: Deploy Preview (unlabeled) | |
if: ${{ github.event.action == 'unlabeled' && github.event.label.name == 'coverage' }} | |
uses: rossjrw/[email protected] | |
with: | |
source-dir: result/coverage/html/ | |
umbrella-dir: coverage/pr-preview | |
action: remove # force removal since, by default, this actions does nothing on the 'labeled' event | |
# -=-=-=-= Deploy (default) =-=-=-=- | |
- name: Deploy Preview (default) | |
if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'coverage') }} | |
uses: rossjrw/[email protected] | |
with: | |
source-dir: result/coverage/html/ | |
umbrella-dir: coverage/pr-preview |