-
Notifications
You must be signed in to change notification settings - Fork 94
122 lines (106 loc) · 4.29 KB
/
release.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
120
121
122
name: Deploy Production environment on Vercel and Publish Docker image
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
vercel-job:
runs-on: ubuntu-latest
# Update the "Production" environment with the Vercel deployed URL
environment:
name: Production
url: ${{ steps.vercel-deploy.outputs.deployment_url }}
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- id: vercel-deploy
run: |
npx -y vercel deploy --target=production --token=${{ secrets.VERCEL_TOKEN }} \
--build-env MDX=docs \
--build-env NEXT_PUBLIC_LIBNAME="Poimandres" \
--build-env NEXT_PUBLIC_LIBNAME_SHORT="pmndrs" \
--build-env BASE_PATH= \
--build-env DIST_DIR= \
--build-env OUTPUT= \
--build-env HOME_REDIRECT= \
--build-env MDX_BASEURL="https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/docs" \
--build-env EDIT_BASEURL="https://github.com/${{ github.repository }}/edit/${{ github.ref_name }}/docs" \
--build-env NEXT_PUBLIC_URL="$VERCEL_PROJECT_PRODUCTION_URL" \
--build-env ICON= \
--build-env LOGO=gutenberg.jpg \
--build-env GITHUB="https://github.com/${{ github.repository }}" \
--build-env DISCORD="${{ secrets.DISCORD }}" \
--build-env THEME_PRIMARY="#323e48" \
--build-env THEME_SCHEME="tonalSpot" \
--build-env THEME_CONTRAST="0" \
--build-env THEME_NOTE="#1f6feb" \
--build-env THEME_TIP="#238636" \
--build-env THEME_IMPORTANT="#8957e5" \
--build-env THEME_WARNING="#d29922" \
--build-env THEME_CAUTION="#da3633" \
> deployment-url.txt
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
semantic-release-job:
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic_release.outputs.new_release_version }}
new_release_major_version: ${{ steps.semantic_release.outputs.new_release_major_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: semantic_release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
docker-job:
runs-on: ubuntu-latest
needs: semantic-release-job
if: needs.semantic-release-job.outputs.new_release_version != ''
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- name: Update `vX` git tag
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
MAJOR_VERSION=${{ needs.semantic-release-job.outputs.new_release_major_version }}
git tag -fa v$MAJOR_VERSION -m "Update major version tag to v$MAJOR_VERSION"
git push origin v$MAJOR_VERSION --force