Skip to content

Commit

Permalink
fix(ci): fix docker builds on release & release rebuilds (#2712)
Browse files Browse the repository at this point in the history
## Description

Allows us to rebuild binaries for a release and attach them again.
Fixes docker input passing when doing a workflow call.

## Breaking Changes

<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
  • Loading branch information
Arqu authored Sep 5, 2024
1 parent c6e2f05 commit 21d75c7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ jobs:
- name: Fetch release binaries
run: |
aws s3 cp s3://vorc/iroh-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh-dns-server
aws s3 cp s3://vorc/iroh-linux-amd64-${{ inputs.base_hash }} bins/linux/amd64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-amd64-${{ inputs.base_hash }} bins/linux/amd64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-amd64-${{ inputs.base_hash }} bins/linux/amd64/iroh-dns-server
aws s3 cp s3://vorc/iroh-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh-dns-server
aws s3 cp s3://vorc/iroh-linux-aarch64-${{ inputs.base_hash }} bins/linux/arm64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-aarch64-${{ inputs.base_hash }} bins/linux/arm64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-aarch64-${{ inputs.base_hash }} bins/linux/arm64/iroh-dns-server
- name: Build Docker image (iroh)
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh:latest,n0computer/iroh:${{ github.event.inputs.release_version }}
push: ${{ inputs.publish }}
tags: n0computer/iroh:latest,n0computer/iroh:${{ inputs.release_version }}
target: iroh
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci
Expand All @@ -98,8 +98,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh-relay:latest,n0computer/iroh-relay:${{ github.event.inputs.release_version }}
push: ${{ inputs.publish }}
tags: n0computer/iroh-relay:latest,n0computer/iroh-relay:${{ inputs.release_version }}
target: iroh-relay
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci
Expand All @@ -108,8 +108,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh-dns-server:latest,n0computer/iroh-dns-server:${{ github.event.inputs.release_version }}
push: ${{ inputs.publish }}
tags: n0computer/iroh-dns-server:latest,n0computer/iroh-dns-server:${{ inputs.release_version }}
target: iroh-dns-server
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ on:
description: "Upload artifacts"
required: true
default: "true"
upload_url:
description: "Upload URL"
required: false
default: ""
base_hash:
description: "Commit hash from which to build"
required: false
type: string
default: ""
push:
tags:
- "v*"
Expand Down Expand Up @@ -122,8 +131,16 @@ jobs:
RUSTV: ${{ matrix.rust }}
steps:
- name: Checkout
if: inputs.base_hash == ''
uses: actions/checkout@v4
with:
submodules: recursive

- name: Checkout specified commit
if: inputs.base_hash != ''
uses: actions/checkout@v4
with:
ref: ${{ inputs.base_hash }}
submodules: recursive

- name: Set build arch
Expand Down Expand Up @@ -261,7 +278,7 @@ jobs:
- uses: n0-computer/actions-upload-release-asset@main
if: (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push')
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
upload_url: ${{ github.event.inputs.upload_url || needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}

docker:
Expand Down

0 comments on commit 21d75c7

Please sign in to comment.