magic-nix-cache/.github/workflows/release-prs.yml
2023-05-21 20:28:43 -04:00

50 lines
1.6 KiB
YAML

name: Release PR
on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
jobs:
release:
concurrency: release
# Only intra-repo PRs are allowed to have PR artifacts uploaded
if: github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer' && contains(github.event.pull_request.labels.*.name, 'upload to s3')
runs-on: ubuntu-latest
permissions:
id-token: write # In order to request a JWT for AWS auth
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create the artifacts directory
run: rm -rf ./artifacts && mkdir ./artifacts
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-macOS
path: cache-binary-macOS
- name: Persist the cache binary
run: cp ./cache-binary-macOS/nix-actions-cache ./artifacts/nix-actions-cache-macOS
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-Linux
path: cache-binary-Linux
- name: Persist the cache binary
run: cp ./cache-binary-Linux/nix-actions-cache ./artifacts/nix-actions-cache-Linux
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
aws-region: us-east-2
- name: Publish Release (PR)
env:
AWS_BUCKET: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
run: |
.github/workflows/upload_s3.sh pr "${{ github.event.pull_request.number }}" "${{ github.event.pull_request.head.sha }}"