-
Notifications
You must be signed in to change notification settings - Fork 4
55 lines (45 loc) · 1.64 KB
/
build.yml
File metadata and controls
55 lines (45 loc) · 1.64 KB
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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: build
on: [push, pull_request, workflow_dispatch]
env:
BUILDDATE: $(date +'%Y-%m-%dT%H-%M-%S')
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Get Date
# https://stackoverflow.com/questions/60942067/get-current-date-and-time-in-github-workflows
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV
- name: User npm ${{matrix.node-version}}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Patch files
uses: onlyutkarsh/patch-files-action@v1.0.1
with:
files: |
./**/config.json
patch-syntax: |
= /version => "${{ env.NOW }}"
- name: Login to azure container registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker build Server Backend
working-directory: ./Server
run: |
docker build . -t ${{ secrets.DOCKER_REGISTRY }}/mpgame-server
docker tag ${{ secrets.DOCKER_REGISTRY }}/mpgame-server ${{ secrets.DOCKER_REGISTRY }}/mpgame-server:$NOW
docker image push ${{ secrets.DOCKER_REGISTRY }}/mpgame-server
env:
CI: true