Skip to content

Commit a3e3a3b

Browse files
authored
Merge pull request #1030 from launchableinc/docker
Automate publishing Docker image using GitHub Actions
2 parents 32ea923 + e7184d0 commit a3e3a3b

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

.github/workflows/python-publish.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
env:
13+
IMAGE_NAME: cloudbees/launchable
14+
1215
jobs:
1316
tagpr:
1417
permissions:
@@ -25,7 +28,7 @@ jobs:
2528
env:
2629
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2730

28-
deploy:
31+
pypi:
2932
needs: tagpr
3033
if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch'
3134

@@ -67,3 +70,44 @@ jobs:
6770
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
6871
with:
6972
args: 'Launchable CLI ${{ needs.tagpr.outputs.tag }} is released! https://github.com/launchableinc/cli/releases/tag/${{ needs.tagpr.outputs.tag }}'
73+
74+
docker:
75+
name: Push Docker image to Docker Hub
76+
needs: tagpr
77+
if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch'
78+
79+
runs-on: ubuntu-22.04
80+
81+
permissions:
82+
packages: write
83+
contents: read
84+
attestations: write
85+
id-token: write
86+
steps:
87+
- name: Check out the repo
88+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
89+
90+
- name: Log in to Docker Hub
91+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
92+
with:
93+
username: ${{ secrets.DOCKER_USERNAME }}
94+
password: ${{ secrets.DOCKER_PASSWORD }}
95+
96+
- name: Build and push Docker image
97+
id: push
98+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
99+
with:
100+
context: .
101+
file: ./Dockerfile
102+
platforms:
103+
- linux/amd64
104+
- linux/arm64
105+
push: true
106+
tags: ${{ env.IMAGE_NAME }}\:${{ needs.tagpr.outputs.tag }}
107+
108+
- name: Generate artifact attestation
109+
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
110+
with:
111+
subject-name: index.docker.io/${{ env.IMAGE_NAME }}
112+
subject-digest: ${{ steps.push.outputs.digest }}
113+
push-to-registry: true

0 commit comments

Comments
 (0)