-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (45 loc) · 1.54 KB
/
buildAndPublish_dev.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
name: Build and publish Docker Hub dev image
on:
push:
branches:
- 'development'
jobs:
build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.KARTAT_DOCKERHUB_USER }}
password: ${{ secrets.KARTAT_DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: hsldevcom/hsl-map-publisher
- name: Get commit hash
id: commit_hash
run: echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Get image timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Build and push timestamped tag
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ format('hsldevcom/hsl-map-publisher:dev-{0}-{1}', steps.timestamp.outputs.timestamp, steps.commit_hash.outputs.hash) }}
build-args: |
BUILD_ENV=dev
DIGITRANSIT_APIKEY=${{ secrets.KARTAT_DIGITRANSITAPIKEY_DEV }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: hsldevcom/hsl-map-publisher:dev
build-args: |
BUILD_ENV=dev
DIGITRANSIT_APIKEY=${{ secrets.KARTAT_DIGITRANSITAPIKEY_DEV }}