-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (81 loc) · 2.77 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (81 loc) · 2.77 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Release
on:
push:
branches:
- main
- master
permissions:
contents: write
pull-requests: write
packages: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 24
- name: Install release dependencies
run: npm ci
- name: Create release PR or publish release
id: changesets
uses: changesets/action@v2.1.2
with:
version-script: npm run version-packages
commit-message: "chore: release"
pr-title: "chore: release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub release
id: github_release
if: steps.changesets.outputs.has-changesets == 'false'
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
- name: Export release metadata
if: steps.github_release.outputs.created == 'true'
run: |
VERSION="${{ steps.github_release.outputs.version }}"
IMAGE_NAME="${{ steps.github_release.outputs.image }}"
VERSION_MINOR=${VERSION%.*}
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "VERSION_MINOR=$VERSION_MINOR" >> "$GITHUB_ENV"
echo "IMAGE_NAME=$IMAGE_NAME" >> "$GITHUB_ENV"
- name: Set up Docker Buildx
if: steps.github_release.outputs.created == 'true'
uses: docker/setup-buildx-action@v4
- name: Set up QEMU
if: steps.github_release.outputs.created == 'true'
uses: docker/setup-qemu-action@v4
- name: Log in to GHCR
if: steps.github_release.outputs.created == 'true'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: steps.github_release.outputs.created == 'true'
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.VERSION }}
${{ env.IMAGE_NAME }}:${{ env.VERSION_MINOR }}
${{ env.IMAGE_NAME }}:latest
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max