-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (36 loc) · 1.26 KB
/
main.yaml
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
name: Release Containerimage
on:
workflow_dispatch:
jobs:
build-test-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: checkout
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build (and test) project with Maven
run: mvn -B package -D skipTests --file pom.xml
- uses: nelonoel/branch-name@v1.0.1
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set env
run: export BRANCH=${BRANCH_NAME}
- run: echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- run: echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- run: echo ${BRANCH}
- uses: mr-smithers-excellent/docker-build-push@v6
name: push-container-image
with:
image: mega-backend
registry: ghcr.io
dockerfile: Containerfile
buildArgs: [COMMIT=${{ env.COMMIT}}, BRANCH=${{ env.BRANCH}}, VERSION=${{ env.VERSION}}]
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}