Repository navigation
108 lines (96 loc) · 3.39 KB
/
Copy pathrelease.yml
File metadata and controls
108 lines (96 loc) · 3.39 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Release
on:
workflow_dispatch:
inputs:
version_increment:
description: 'La version a incrémenter (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- 'major'
- 'minor'
- 'patch'
build_docker_image:
description: "Construire l'image docker ?"
required: true
default: true
type: boolean
latest:
description: "Tagger l'image docker avec le tag 'latest' ?"
required: true
default: false
type: boolean
unstable_only:
description: "Construire uniquement l'image docker avec le tag 'unstable' (sans numéro de version ni release) ?"
required: true
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run API unit tests
run: yarn workspace @libertech-fr/sesame-orchestrator_api test
- name: Build docker
if: ${{ github.event.inputs.unstable_only != 'true' }}
uses: ./.github/actions/release
with:
version_increment: ${{ github.event.inputs.version_increment }}
build_docker_image: ${{ github.event.inputs.build_docker_image }}
latest: ${{ github.event.inputs.latest }}
repository: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
access_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
args: |
BUILD_VERSION={{NEW_VERSION}}
GIT_BRANCH=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}
GIT_SHA=${{ github.sha }}
DOCKER_TAG={{NEW_VERSION}}
IMAGE_TAG={{NEW_VERSION}}
- name: Get repo full name
if: ${{ github.event.inputs.unstable_only == 'true' }}
run: echo "REPO_FULL_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up QEMU
if: ${{ github.event.inputs.unstable_only == 'true' }}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: ${{ github.event.inputs.unstable_only == 'true' }}
uses: docker/setup-buildx-action@v3.10.0
- name: Log in to the Container registry
if: ${{ github.event.inputs.unstable_only == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push unstable Docker image
if: ${{ github.event.inputs.unstable_only == 'true' }}
uses: docker/build-push-action@v6.18.0
with:
context: .
push: true
tags: ghcr.io/${{ env.REPO_FULL_NAME }}:unstable
platforms: linux/amd64
build-args: |
BUILD_VERSION=unstable
GIT_BRANCH=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}
GIT_SHA=${{ github.sha }}
DOCKER_TAG=unstable
IMAGE_TAG=unstable