-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (61 loc) · 2.11 KB
/
publish-dev.yml
File metadata and controls
70 lines (61 loc) · 2.11 KB
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
name: 👷 publish dev
on:
push:
# TODO: choose your "feature branch" naming (or leave it like this)
# or run this on every non-main branch, replacing the whole `branches` with
# branches-ignore:
# - main
branches:
- dev
- dev/*
- dev-*
jobs:
test_and_publish:
uses: ./.github/workflows/publish.yml
with:
version: '${{ github.run_number }}.0.0'
repository: testpypi
secrets:
twine_token: ${{ secrets.TESTPYPI_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build_image:
# TODO: remove this entire job if an image does not make sense (ie: just a library, no CLI)
permissions: write-all
needs: test_and_publish
name: test image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Sanitize branch name
id: sanitize_branch
run: |
SANITIZED_BRANCH=$(echo -n "${{ github.ref_name }}" | tr '/' '-' | tr -c '[:alnum:]-' '-')
echo sanitized_branch=$SANITIZED_BRANCH >> $GITHUB_OUTPUT
- name: Build and push image - release
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
cache-from: ghcr.io/${{ github.repository }}:latest-build-cache
tags: |
ghcr.io/${{ github.repository }}:${{ steps.sanitize_branch.outputs.sanitized_branch }}
- name: Show summary
run: |
echo 'Published: ' >> ${GITHUB_STEP_SUMMARY}
echo '* `ghcr.io/${{ github.repository }}:${{ steps.sanitize_branch.outputs.sanitized_branch }}`' >> ${GITHUB_STEP_SUMMARY}