-
Notifications
You must be signed in to change notification settings - Fork 120
47 lines (45 loc) · 1.63 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
name: Release
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
docker-build-and-publish:
name: "Docker: Build & Publish"
runs-on: ubuntu-latest
steps:
- name: "Config: Registry"
run: echo "REGISTRY=ghcr.io" >> $GITHUB_ENV
- name: "Config: Image Name"
run: echo "IMAGE_NAME=${{ github.repository_owner }}/$(basename ${{ github.repository }})" >> $GITHUB_ENV
- name: "Config: Image URL"
run: echo "IMAGE_URL=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV
# Derriving semver tags this way is hacky, but the action doesn't seem to think you would want to set
# both latest AND semver...
- name: "Config: Semver Tags"
run: |
echo "SEMVER_TAGS=$(echo ${{ github.ref }} \
| sed -e 's/refs\/tags\///g' \
| sed -E 's/v?([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z]+(\.[0-9]+)?)?/\1.\2.\3\4\,\1.\2\4\,\1\4/g')" >> $GITHUB_ENV
- name: "Repo: Checkout"
uses: actions/checkout@v4
- name: "Docker: Build & Publish"
id: build
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ env.IMAGE_NAME }}
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.PUBLISH_TOKEN }}
tags: latest,stable,${{ env.SEMVER_TAGS }}