-
Notifications
You must be signed in to change notification settings - Fork 36
44 lines (35 loc) · 1.12 KB
/
build_push.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
name: Build and Push
on:
push:
branches:
- master
jobs:
build_and_push:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, 'chore(release):')
permissions:
contents: read
packages: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Get version from package.json
id: package_version
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
- 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
run: |-
docker build \
--tag "digichanges/nexp-api:${{ env.PACKAGE_VERSION }}" \
--tag "digichanges/nexp-api:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
- name: Publish
run: docker push "digichanges/nexp-api" --all-tags