-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.31 KB
/
gh_pkg_build.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
# give the image a name
name: Build Docker Image
# set which GitHub events trigger this workflow
on:
push:
tags:
- '*'
# set some environment variables
env:
REGISTRY: ghcr.io
REPO: chalklab/trc_mysql
# define a job to run
# this takes the 'Dockerfile' file at the root level and builds the image it defines and then
# saves the image in the GitHub Container Registry (ghcr) under this organizational account
# (see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: extract_tag
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO }}:${{ steps.extract_tag.outputs.tag_name }}