-
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (98 loc) · 4 KB
/
2023-docker.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#############################################################################
# BUILD, PUSH, AND DEPLOY
#############################################################################
name: 2023 - 🌐🐦⚡️ Build & Push Docker Image
on:
pull_request:
branches:
- 2023
workflow_dispatch:
concurrency: ${{ github.workflow }}-refs/heads/2023
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
ID: 2023
WEB_DIR: packages/web
###############################################################################
# JOBS
###############################################################################
jobs:
deploy:
runs-on: 'ubuntu-latest'
steps:
#########################################################################
# INIT
#########################################################################
- name: ⬇️🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️🛎 Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.ID }}
- name: ⬇️🥡 Install pnpm
uses: pnpm/action-setup@v4
- name: ⬇️🟢 Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
# - name: ⬇️📦 Install dependencies
# run: pnpm install --no-frozen-lockfile
- name: ⬇️🐳 Set up QEMU
uses: docker/setup-qemu-action@v1
- name: ⬇️🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 🐳☑️ Login to Docker Hub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: 🐳☑️ Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 📦📄 Get package.json data
id: pkg
run: |
echo "name=$(jq -r '.extra.productName' ./package.json)" >> $GITHUB_OUTPUT
echo "description=$(jq -r '.description' ./package.json)" >> $GITHUB_OUTPUT
echo "homepage=$(jq -r '.homepage' ./package.json)" >> $GITHUB_OUTPUT
echo "version=$(jq -r '.version' ${{env.WEB_DIR}}/package.json)" >> $GITHUB_OUTPUT
#########################################################################
# PUSH IMAGE
#########################################################################
- name: 🐳🚀 Build and push image
uses: docker/build-push-action@v4
with:
context: ${{env.WEB_DIR}}
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ github.repository }}:${{ env.ID }}-${{ steps.pkg.outputs.version }}
ghcr.io/${{ github.repository }}:${{ env.ID }}-latest
#########################################################################
# UPDATE DOCKERHUB DATA
#########################################################################
- name: 🐳📝 Update Docker Hub repo description
uses: peter-evans/dockerhub-description@v3
with:
# @see https://github.com/peter-evans/dockerhub-description
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
repository: ${{ github.repository }}
short-description: ${{ steps.pkg.outputs.description }}
readme-filepath: ./README.md
- name: Add release
uses: ncipollo/release-action@v1
with:
tag: "${{ env.ID }}-${{ steps.pkg.outputs.version }}"
draft: false
prerelease: false
allowUpdates: true
body: |
PigeonPosse Web [${{ env.ID }}] v.${{ steps.pkg.outputs.version }}
omitBodyDuringUpdate: true
###############################################################################