-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (53 loc) · 1.56 KB
/
deploy.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
name: Deploy Container
on:
push:
tags:
- "*@*.*.*"
permissions:
contents: write
packages: write
id-token: write
pull-requests: write
env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
AU TH_URL: ${{ secrets.AUTH_URL }}
NEXT_PUBLIC_URL: ${{ secrets.NEXT_PUBLIC_URL }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GIT_TOKEN }}
- name: get the tag and set is as the image version
id: vars
run: |
TAG=${GITHUB_REF#refs/*/}
TAG=${TAG#*@} # This line extracts the part after the '@' symbol
echo ::set-output name=tag::$TAG
echo $TAG
echo "
AUTH_SECRET=${AUTH_SECRET}
AUTH_URL=${AUTH_URL}
NEXT_PUBLIC_URL=${NEXT_PUBLIC_URL}
">.env
- name: Build and push
run: |
docker build -t ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.tag }} .
docker push ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.tag }}
- name: create a release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')