This repository was archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
79 lines (66 loc) · 2.25 KB
/
Copy pathcontainerbuildpush.yml
File metadata and controls
79 lines (66 loc) · 2.25 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Container Build & Push - ColoursWeb
on:
workflow_dispatch:
env:
IMAGENAME: coloursweb
jobs:
app-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Install npm packages
run: |
npm config set package-lock false
npm i
npm install -g grunt-cli
- name: run grunt build - to process LESS, compress JS and CSS
run: grunt build --verbose
- name: push any changes
run: |
if expr $(git status --porcelain | wc -l) \> 0
then
git status --porcelain
git config user.email "markharrison-GitHubAction@users.noreply.github.com"
git config user.name "markharrison-GitHubAction"
git add .
git commit -m "Grunt Build (Action ${{ github.run_number }})"
git push
else
echo "Working tree clean. Nothing to commit."
fi
- name: format IMAGETAG
run: |
echo "IMAGETAG=$(date "+%Y%m%d")-${{github.run_number }}" >> $GITHUB_ENV
- uses: cschleiden/replace-tokens@v1
with:
files: '["appsettings.json"]'
env:
BuildIdentifier: ${{ env.IMAGETAG }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Package Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v2.2.1
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: >
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGENAME }}:${{ env.IMAGETAG }},
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGENAME }}:latest,
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGENAME }}:${{ env.IMAGETAG }},
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGENAME }}:latest