-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.43 KB
/
build-and-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
45
46
47
name: Build and push Docker image
# Turns out on release does not actually run on release. thanks microsoft
# See https://github.com/orgs/community/discussions/25281
# on:
# release:
# types: [published]
on:
workflow_run:
workflows: ['Bump Version and Create Release']
types:
- completed
jobs:
build-and-push:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Get Release Tag
id: get_tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=$(gh release view --json tagName -q .tagName)
echo "TAG=$TAG" >> "$GITHUB_ENV"
# TAG=$(gh release view "${{ github.event.workflow_run.head_commit.id }}" --json tagName -q .tagName)
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/bus-map:latest
ghcr.io/${{ github.repository_owner }}/bus-map:${{ env.TAG }}
# ghcr.io/${{ github.repository_owner }}/bus-map:${{ github.event.release.tag_name }}