-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (56 loc) · 1.94 KB
/
release.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
55
56
name: Release
run-name: Release ${{ inputs.version || github.ref_name }}
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
version:
required: true
type: string
description: Version (vX.X.X)
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
VERSION: ${{ inputs.version || github.ref_name }}
RELEASE_ZIP_FILENAME: ${{ github.event.repository.name }}-${{ inputs.version || github.ref_name }}.zip
DOCKER_IMAGE_NAME: ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create release ZIP file
run: zip -r $RELEASE_ZIP_FILENAME . -x /.git/* -x /.github/* -x /.dockerignore -x /Dockerfile
- name: Delete existing GitHub release, if any
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh release delete $VERSION --cleanup-tag --yes || true
- name: Release on GitHub
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
tag_name: ${{ env.VERSION }}
generate_release_notes: true
files: ${{ env.RELEASE_ZIP_FILENAME }}
- name: Delete release ZIP file
run: rm $RELEASE_ZIP_FILENAME
- name: Sign into GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ env.VERSION }},${{ env.DOCKER_IMAGE_NAME }}:latest