-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (46 loc) · 1.35 KB
/
build-image.yml
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
on:
workflow_run:
workflows: ["Lint"]
branches: [main]
types:
- completed
name: Docker build and push
jobs:
build:
name: Docker build and push
if: '!github.event.deleted'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Bump version and push tag
if: github.ref == 'refs/heads/main'
uses: anothrNick/github-tag-action@master
id: version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: main
WITH_V: false
DEFAULT_BUMP: patch
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: |
version=${{ steps.version.outputs.new_tag }}
tags: |
ghcr.io/reload/${{ github.repository}}:latest
ghcr.io/reload/${{ github.repository}}:${{ steps.version.outputs.new_tag }}
push: true