-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (77 loc) · 2.7 KB
/
backend-release.yml
File metadata and controls
90 lines (77 loc) · 2.7 KB
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
# Fix for .github/workflows/backend-release.yml
name: Backend Release
on:
pull_request:
types: [closed]
branches:
- main
paths:
- 'services/backend/**'
permissions:
contents: write
pull-requests: write
jobs:
release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'backend') && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
# Install dependencies at root level for workspaces
- name: Install dependencies
run: npm ci
# Now run release-it with the --no-git.requireCleanWorkingDir flag
- name: Prepare release
working-directory: services/backend
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run release -- --ci --verbose --no-git.requireCleanWorkingDir
# Get the version after release-it has run
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: services/backend
# Build the backend
- name: Build backend
working-directory: services/backend
run: |
npm run build
# Prepare shared resources directory for Docker
- name: Prepare shared directories
run: |
mkdir -p /tmp/shared
cp -r services/shared/* /tmp/shared/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./services/backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
deploystack/backend:latest
deploystack/backend:v${{ steps.package-version.outputs.current-version }}
build-args: |
DEPLOYSTACK_BACKEND_VERSION=${{ steps.package-version.outputs.current-version }}
cache-from: type=gha
cache-to: type=gha,mode=max