forked from openscd/open-scd
-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (51 loc) · 1.75 KB
/
release-project.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
# SPDX-FileCopyrightText: 2022 Alliander N.V.
#
# SPDX-License-Identifier: Apache-2.0
name: Release Project
on:
release:
types: [released]
jobs:
push_to_registry:
name: Build and publish
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/[email protected]
- name: Cache Docker Register
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
- name: Extract tag name
id: extract_tagname
shell: bash
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Build application with npm
run: |
npm ci
npm run-script build
- name: Build and push docker image to Docker Hub
uses: docker/build-push-action@v5
with:
# Set the context to use the packages/compas-open-scd directory and not execute it's own git checkout.
context: packages/compas-open-scd
push: true
# Tag the images using the tagname and also latest.
tags: |
lfenergy/compas-open-scd:${{ steps.extract_tagname.outputs.tagname }}
lfenergy/compas-open-scd:latest