-
Notifications
You must be signed in to change notification settings - Fork 555
87 lines (83 loc) · 2.5 KB
/
docker-images.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
85
86
87
name: Docker Images
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
docker-push: ${{ steps.vars.outputs.docker-push }}
oci-reference: ${{ steps.vars.outputs.oci-reference }}
steps:
- id: vars
run: |
echo ::set-output name=github-ref::${{ github.ref }}
echo ::set-output name=docker-push::${{ github.ref == 'refs/heads/main' }}
echo ::set-output name=oci-reference::ghcr.io/$( echo "${{ github.repository}}" | tr '[:upper:]' '[:lower:]' )
- id: vars-dump
run: |
echo "steps.vars.github-ref = ${{ steps.vars.outputs.github-ref }}"
echo "steps.vars.docker-push = ${{ steps.vars.outputs.docker-push }}"
echo "steps.vars.oci-reference = ${{ steps.vars.outputs.oci-reference }}"
build:
needs: setup
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install poetry
run: |
pip install -r devtools/requirements-poetry.in
- name: Build images
shell: bash
run: |
task \
OCI_REFERENCE="${{ needs.setup.outputs.oci-reference }}" \
docker:latest docker:unstable
push:
if: "${{ needs.setup.outputs.docker-push == 'true' }}"
needs: [ setup, build ]
permissions:
id-token: write
packages: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install poetry
run: |
pip install -r devtools/requirements-poetry.in
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images
shell: bash
run: |
task \
DOCKER_PUSH=true \
OCI_REFERENCE="${{ needs.setup.outputs.oci-reference }}" \
docker:latest docker:unstable