-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.86 KB
/
publish-artifacts.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Publish Docker 🐳 images 📦 to GitHub Container Registry
on:
push:
tags:
- '**'
jobs:
build-release-pkg:
name: Builds and publishes a self-contained package to the release
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Write version
run: ./scripts/insert-version-pyproject.sh ${{github.ref_name}}
- name: Build package
run: |
make pkg
mv ./dist/main ./generic-k8s-webhook-linux-${{github.ref_name}}
# FIXME Uncomment this once we enable softprops/action-gh-release@v2
# - name: Publish package
# uses: softprops/action-gh-release@v2
# with:
# files: generic-k8s-webhook-linux-${{github.ref_name}}
build-and-publish-to-ghcr:
# Explicitly grant the `secrets.GITHUB_TOKEN` permissions.
permissions:
# Grant the ability to write to GitHub Packages (push Docker images to
# GitHub Container Registry).
packages: write
name: Build and publish Docker 🐳 images 📦 to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Write version
run: ./scripts/insert-version-pyproject.sh ${{github.ref_name}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
# This is the user that triggered the Workflow. In this case, it will
# either be the user whom created the Release or manually triggered
# the workflow_dispatch.
username: ${{ github.actor }}
# `secrets.GITHUB_TOKEN` is a secret that's automatically generated by
# GitHub Actions at the start of a workflow run to identify the job.
# This is used to authenticate against GitHub Container Registry.
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
# for more detailed information.
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true # push the image to ghcr
tags: >
ghcr.io/thought-machine/generic-k8s-webhook:${{github.sha}},
ghcr.io/thought-machine/generic-k8s-webhook:${{github.ref_name}}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64