-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 2.1 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
57
58
59
60
61
62
63
64
65
name: Release
# Release workflow builds and publishes the Docker image to provenaceio/npm-publish repository.
# This workflow is run on release tags.
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+" # Push events to matching #.#.#, i.e. 1.0, 20.15.10
- "[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching #.#.#-rc#, i.e. 1.0-rc1, 20.15.10-rc5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Set tag version
run: |
VERSION=${GITHUB_REF##*/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
PRE_RELEASE=false
if [[ "$VERSION" =~ -rc ]]; then
PRE_RELEASE=true
fi
echo "PRE_RELEASE=$PRE_RELEASE" >> "$GITHUB_ENV"
DOCKER_IMAGE=provenanceio/npm-publish
TAGS="$DOCKER_IMAGE:latest,$DOCKER_IMAGE:$VERSION"
echo "TAGS=$TAGS" >> "$GITHUB_ENV"
- name: Defined tag version
run: |
echo "DOCKER_IMAGE=$DOCKER_IMAGE"
echo "VERSION=$VERSION"
echo "PRE_RELEASE=$PRE_RELEASE"
echo "TAGS=$TAGS"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
build-args: |
VERSION=${{ env.VERSION }}
platforms: linux/amd64
push: true
tags: ${{ env.TAGS }}
- name: Checkout
uses: actions/checkout@v3
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
prerelease: ${{ env.PRE_RELEASE }}
body_path: "RELEASE_CHANGELOG.md"