Repository navigation
61 lines (50 loc) · 1.5 KB
/
Copy pathgithub-deploy.yml
File metadata and controls
61 lines (50 loc) · 1.5 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
name: Deploy to GitHub Container Registry
on:
push:
branches:
- main
jobs:
build-and-push:
name: Publish Docker Images
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Checkout head
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Read version from file
id: get_version
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Echo metadata
run: |
echo "version: ${{ env.VERSION }}"
echo "sha: ${{ github.sha }}"
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
build-args: |
VERSION=${{ env.VERSION }}
- name: Log out from GitHub Container Registry
run: docker logout ghcr.io