Skip to content

Commit 4c3a541

Browse files
authored
Make releasing the dev container release the WASI container (#58)
1 parent ca75f66 commit 4c3a541

File tree

2 files changed

+72
-34
lines changed

2 files changed

+72
-34
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Container
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
container:
7+
description: "Container image name"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build-and-push:
13+
concurrency:
14+
group: release-to-ghcr-${{ inputs.container }}
15+
cancel-in-progress: false
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
steps:
21+
- name: Set Calver Date
22+
run: |
23+
echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
24+
id: version
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
- name: Login To GHCR
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Build and push
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: ./${{ inputs.container }}
41+
platforms: linux/amd64,linux/arm64
42+
push: true
43+
tags: |
44+
ghcr.io/python/${{ inputs.container }}:${{ steps.version.outputs.builddate }}.${{ github.run_id }}
45+
ghcr.io/python/${{ inputs.container }}:latest

.github/workflows/release.yml

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: release
33
on:
44
workflow_dispatch:
55
inputs:
6-
package:
7-
description: "Package name"
6+
container:
7+
description: "Container image name"
88
required: true
99
default: 'autoconf'
1010
type: choice
@@ -13,39 +13,32 @@ on:
1313
- devcontainer
1414
- wasicontainer
1515

16-
run-name: "Release: ${{ inputs.package }}"
16+
run-name: "Release: ${{ inputs.container }}${{ inputs.container == 'devcontainer' && ' + wasicontainer' || '' }}"
1717

1818
jobs:
19-
release-to-ghcr:
20-
concurrency:
21-
group: release-to-ghcr-${{ inputs.package }}
22-
cancel-in-progress: false
23-
if: contains('["brettcannon", "corona10", "erlend-aasland"]', github.actor)
19+
authorize:
2420
runs-on: ubuntu-latest
21+
if: contains('["brettcannon", "corona10", "erlend-aasland"]', github.actor)
2522
steps:
26-
# Checkout push-to-registry action github repository
27-
- name: Set Calver Date
28-
run: |
29-
echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
30-
id: version
31-
- name: Checkout Push to Registry action
32-
uses: actions/checkout@v5
33-
- name: Set up QEMU
34-
uses: docker/setup-qemu-action@v3
35-
- name: Set up Docker Buildx
36-
uses: docker/setup-buildx-action@v3
37-
- name: Login To GHCR
38-
uses: docker/login-action@v3
39-
with:
40-
registry: ghcr.io
41-
username: ${{ github.actor }}
42-
password: ${{ secrets.GITHUB_TOKEN }}
43-
- name: Build and push
44-
uses: docker/build-push-action@v6
45-
with:
46-
context: ./${{ inputs.package }}
47-
platforms: linux/amd64,linux/arm64
48-
push: true
49-
tags: |
50-
ghcr.io/python/${{ inputs.package }}:${{ steps.version.outputs.builddate }}.${{ github.run_id }}
51-
ghcr.io/python/${{ inputs.package }}:latest
23+
- run: echo "Authorized"
24+
25+
release-to-ghcr:
26+
name: Release ${{ inputs.container }}
27+
needs: authorize
28+
uses: ./.github/workflows/build-and-push.yml
29+
permissions:
30+
contents: read
31+
packages: write
32+
with:
33+
container: ${{ inputs.container }}
34+
35+
release-wasicontainer:
36+
name: Release wasicontainer (due to devcontainer updates)
37+
needs: [authorize, release-to-ghcr]
38+
if: inputs.container == 'devcontainer'
39+
uses: ./.github/workflows/build-and-push.yml
40+
permissions:
41+
contents: read
42+
packages: write
43+
with:
44+
container: wasicontainer

0 commit comments

Comments
 (0)