-
Notifications
You must be signed in to change notification settings - Fork 58
63 lines (52 loc) · 2.12 KB
/
docker-publish.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
54
55
56
57
58
59
60
61
62
63
# Build Docker image of Iamus metaverse-server and publish in
# Github Container Registry as "vircadia/Iamus".
name: Iamus Docker image
on:
# Create Docker image on push to 'master'
push:
branches:
- master
env:
# Names used to tag built Docker image
IMAGE_NAME: iamus
# The local Docker image is named env.IMAGE_TAG so it can be referenced and pushed
IMAGE_TAG: iamus:latest
jobs:
push:
runs-on: ubuntu-latest
steps:
# Checkout the repository into current runner context
- name: checkout
uses: actions/checkout@v2
# Setup buildx environment (used if building for multiple platforms)
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
# Build Iamus
- name: Build
uses: docker/build-push-action@v2
with:
context: ./docker
platforms: linux/amd64
# platforms: linux/amd64,linux/arm64
tags: ${{ env.IMAGE_TAG }}
# Get version information from built image.
# The unique version tag is generated during the build. Extract version string for image tagging.
- name: Fetch version information
run: |
IVERSION=$(docker run --rm --entrypoint "./GetVersion.sh" ${{ env.IMAGE_TAG }})
echo "IVERSION=$IVERSION"
echo "IVERSION=$IVERSION" >> $GITHUB_ENV
# Login to Github Container Registry with this registry's tokens
- name: Login to Github Container registry
uses: docker/#-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Push to Github Container Registry
- name: Push to Github Container Registry
run: |
docker image tag ${{ env.IMAGE_TAG }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
docker image tag ${{ env.IMAGE_TAG }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.IVERSION }}
docker image push --all-tags ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
# vim: tabstop=2 shiftwidth=2 autoindent expandtab