forked from Fraunhofer-AISEC/ids-clearing-house-service
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (66 loc) · 2.19 KB
/
release-publish.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
name: Release
on:
push:
branches:
- master
- alpha
- beta
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_tag_version: ${{ steps.tag_version.outputs.new_tag_version }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Dry run to get the next release version
id: tag_version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:alnum:].\-]+)$/\1/')
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
publish-docker-images:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.new_tag_version != '' }}
permissions:
contents: read
packages: write
id-token: write
strategy:
matrix:
include:
- context: "ch-app"
directory: "clearing-house-app"
dockerfile: "Dockerfile"
- context: "ch-edc"
directory: "clearing-house-edc"
dockerfile: "launchers/connector-prod/Dockerfile"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build Docker image
env:
DOCKER_IMAGE_TAG: ${{ needs.release.outputs.new_tag_version }}
run: |
cd ${{ matrix.directory }}
docker build -t ghcr.io/${{ github.repository }}/${{ matrix.context }}:$DOCKER_IMAGE_TAG -f ${{ matrix.dockerfile }} .
- name: Push Docker image
env:
DOCKER_IMAGE_TAG: ${{ needs.release.outputs.new_tag_version }}
run: docker push ghcr.io/${{ github.repository }}/${{ matrix.context }}:$DOCKER_IMAGE_TAG