generated from swaglive/docker-IMAGE
-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 1.96 KB
/
release.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
name: Release
on:
push:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Environment - Setup buildx
uses: docker/setup-buildx-action@v1
- name: Setup Environment - Set variable `push-to-registry`
id: push-to-registry
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: ^refs\/tags\/
- name: Setup Environment - Login to Github Container Registry
uses: docker/login-action@v1
if: ${{ steps.push-to-registry.outputs.match != '' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Environment - Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build
uses: docker/build-push-action@v2
with:
context: .
push: ${{ steps.push-to-registry.outputs.match != '' }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
create-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build-docker
steps:
- name: Setup Environment - Set variable `check-if-prelease`
id: check-if-prelease
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: ^refs\/tags\/v?[0-9]+\.[0-9]+\.[0-9]+\-
- name: Create Release
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ steps.check-if-prelease.outputs.match != '' }}
fail_on_unmatched_files: true
discussion_category_name: Announcements