forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 8
54 lines (46 loc) · 1.39 KB
/
build.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
48
49
50
51
52
53
54
name: Build and Publish
run-name: Build and publish Docker image for ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}
on:
workflow_dispatch:
inputs:
ref:
description: 'Ref to build'
required: true
push:
tags:
'*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch Go modules
run: make vendor
- name: Build and push rootless Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
file: Dockerfile.rootless
tags: ghcr.io/${{ github.repository }}:${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}