-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.79 KB
/
ci.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Primary workflow for building, testing, and deploying the Toontown Classic OTP server packages
name: Toontown Classic OTP CI
on:
# Release a new static anytime a release change is published to the repository
push:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
- '!gh-pages' # excludes gh-pages
# Create a latest image and deploy changes to Github Pages on a version publish
release:
types: [published]
# Allow manual deployments from Github's UI/API
workflow_dispatch:
# Define workflow constants as environment variables
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_PREFIX: toontown-classic
IMAGE_SUFFIX: otp
DOCKERHUB_OWNER: thetestgame
jobs:
# Publishes the download server Docker images to all supported repositories
push_to_registries:
name: Push Docker Images
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Define the job's permissions
permissions:
packages: write
contents: read
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out the release branch of the repository under $GITHUB_WORKSPACE
- name: Check out the repo
uses: actions/checkout@v2
# Authenticate with DockerHub prior to pushing
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Authenticate with the Github packages registry prior to pushing
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata about this job execution and pack it into the various outgoing Docker images
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
${{ env.DOCKERHUB_OWNER }}/${{ env.IMAGE_PREFIX }}-${{ env.IMAGE_SUFFIX }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.IMAGE_PREFIX }}-${{ env.IMAGE_SUFFIX }}
# Deploy our created Docker images to the supported registries
- name: build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}