Skip to content

.github: switch from actions/cache to actions/{download,upload}-artifact #2075

.github: switch from actions/cache to actions/{download,upload}-artifact

.github: switch from actions/cache to actions/{download,upload}-artifact #2075

Workflow file for this run

name: Release PR
concurrency:
group: release
on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
permissions:
id-token: "write"
contents: "read"
jobs:
build-x86_64-linux:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
always() && !failure() && !cancelled()
&& github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
uses: ./.github/workflows/build-x86_64-linux.yml
build-aarch64-linux:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
always() && !failure() && !cancelled()
&& github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
uses: ./.github/workflows/build-aarch64-linux.yml
build-x86_64-darwin:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
always() && !failure() && !cancelled()
&& github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
uses: ./.github/workflows/build-x86_64-darwin.yml
build-aarch64-darwin:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
always() && !failure() && !cancelled()
&& github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
uses: ./.github/workflows/build-aarch64-darwin.yml
release:
# Only intra-repo PRs are allowed to have PR artifacts uploaded
# We only want to trigger once the upload once in the case the upload label is added, not when any label is added
if: |
always() && !failure() && !cancelled()
&& github.event.pull_request.head.repo.full_name == 'DeterminateSystems/nix-installer'
&& (
(github.event.action == 'labeled' && github.event.label.name == 'upload to s3')
|| (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'upload to s3'))
)
runs-on: ubuntu-latest
needs:
- build-x86_64-linux
- build-aarch64-linux
- build-x86_64-darwin
- build-aarch64-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create artifacts directory
run: mkdir -p ./artifacts
# NOTE: ownload-artifact with a single binary file, with `path` specified,
# will place the binary inside a folder designated by `path` (likely not what you want)
# However, without `path`, it creates no subdirectory and drops the raw file in CWD
# NOTE: So, download them to CWD then move them to their expected location explicitly
- name: Fetch x86_64-linux binary artifact
uses: actions/download-artifact@v4
with:
name: nix-installer-x86_64-linux
- name: Fetch aarch64-linux binary artifact
uses: actions/download-artifact@v4
with:
name: nix-installer-aarch64-linux
- name: Fetch x86_64-darwin binary artifact
uses: actions/download-artifact@v4
with:
name: nix-installer-x86_64-darwin
- name: Fetch aarch64-darwin binary artifact
uses: actions/download-artifact@v4
with:
name: nix-installer-aarch64-darwin
- name: Move binaries into upload staging ir
run: |
mv nix-installer-x86_64-linux artifacts/
mv nix-installer-aarch64-linux artifacts/
mv nix-installer-x86_64-darwin artifacts/
mv nix-installer-aarch64-darwin artifacts/
- 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: |
PR="pr_${{ github.event.pull_request.number }}"
GIT_ISH="${{ github.event.pull_request.head.sha }}"
./upload_s3.sh "$PR" "$GIT_ISH" "https://install.determinate.systems/nix/rev/$GIT_ISH"
- name: Install Instructions (PR)
run: |
cat <<EOF
This commit can be installed by running the following command:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/rev/${{ github.event.pull_request.head.sha }} | sh -s -- install
The latest commit from this PR can be installed by running the following command:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/${{ github.event.pull_request.number }} | sh -s -- install
EOF