-
-
Notifications
You must be signed in to change notification settings - Fork 121
76 lines (69 loc) · 2.69 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
66
67
68
69
70
71
72
73
74
75
76
name: Release
on: workflow_dispatch
jobs:
release-npm:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
env:
HUSKY: '0'
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Cache Node.js modules
uses: actions/cache@v2.1.7
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-16.x-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-16.x
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Create new release
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
extra_plugins: |
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release-docker:
runs-on: ubuntu-latest
needs: release-npm
if: needs.release-npm.outputs.new_release_published == 'true'
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Cache Docker layers
uses: actions/cache@v2.1.7
with:
path: /tmp/.buildx-cache
key: ${{ runner.OS }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.OS }}-buildx-
- name: Run Buildx
run: docker buildx build --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --build-arg ROOM_ASSISTANT_VERSION=${{needs.release-npm.outputs.new_release_version}} --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 -t mkerix/room-assistant:${{needs.release-npm.outputs.new_release_version}} -t mkerix/room-assistant:$([[ "${{needs.release-npm.outputs.new_release_version}}" == *"beta"* ]] && echo "beta" || echo "latest") --push .
- name: Update description on DockerHub
uses: peter-evans/dockerhub-description@v2.4.3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: mkerix/room-assistant