-
Notifications
You must be signed in to change notification settings - Fork 14
97 lines (80 loc) · 3.48 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Builds DevU images for release
# tagged as latest and version number
name: Release
on:
push:
branches:
- release
jobs:
tag-release:
name: tag-release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
packages: write # to be able to publish docker image packages
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: install plugins
run: npm install --no-save @semantic-release/git @semantic-release/changelog -D
- name: tag version number release based on commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
build-docker:
needs:
- tag-release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
packages: write # to be able to publish docker images
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Get version tag from git history
id: tagName
uses: "WyriHaximus/github-action-get-previous-tag@v1"
# todo run tests
- name: Convert image name to lowercase
run: |
original_string=${{ github.repository }}
echo "repo_url=$(echo $original_string | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
# docker image build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: API latest and version image
run: |
docker build . -f api.Dockerfile -t ghcr.io/${{ env.repo_url }}-api:${{ steps.tagName.outputs.tag }}
docker push ghcr.io/${{ env.repo_url }}-api:${{ steps.tagName.outputs.tag }}
docker build . -f api.Dockerfile -t ghcr.io/${{ env.repo_url }}-api:latest
docker push ghcr.io/${{ env.repo_url }}-api:latest
- name: client latest and version image
run: |
docker build . -f client.Dockerfile -t ghcr.io/${{ env.repo_url }}-client:${{ steps.tagName.outputs.tag }}
docker push ghcr.io/${{ env.repo_url }}-client:${{ steps.tagName.outputs.tag }}
docker build . -f client.Dockerfile -t ghcr.io/${{ env.repo_url }}-client:latest
docker push ghcr.io/${{ env.repo_url }}-client:latest
- name: nginx latest and version image
run: |
docker build . -f nginx.Dockerfile -t ghcr.io/${{ env.repo_url }}-nginx:${{ steps.tagName.outputs.tag }}
docker push ghcr.io/${{ env.repo_url }}-nginx:${{ steps.tagName.outputs.tag }}
docker build . -f nginx.Dockerfile -t ghcr.io/${{ env.repo_url }}-nginx:latest
docker push ghcr.io/${{ env.repo_url }}-nginx:latest
- name: tango latest and version image
run: |
docker build ./tango -f ./tango/Dockerfile -t ghcr.io/${{ env.repo_url }}-tango:latest
docker push ghcr.io/${{ env.repo_url }}-tango:latest