-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (99 loc) · 3.48 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (99 loc) · 3.48 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Release
on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
packages: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ steps.app-token.outputs.token }}
docker:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version tags
id: version
run: |
VERSION="${{ needs.release-please.outputs.tag_name }}"
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "minor=${VERSION%.*}" >> "$GITHUB_OUTPUT"
echo "major=${VERSION%%.*}" >> "$GITHUB_OUTPUT"
- uses: docker/metadata-action@v6
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ steps.version.outputs.version }}
type=raw,value=${{ steps.version.outputs.minor }}
type=raw,value=${{ steps.version.outputs.major }}
type=raw,value=latest
- uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
npm:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- name: Copy changelog to packages
run: |
cp CHANGELOG.md packages/core/CHANGELOG.md
cp CHANGELOG.md packages/cli/CHANGELOG.md
- name: Set release version and pin core dependency
run: |
VERSION="${{ needs.release-please.outputs.tag_name }}"
VERSION="${VERSION#v}"
npm version "$VERSION" --no-git-tag-version --workspace=packages/core
npm version "$VERSION" --no-git-tag-version --workspace=packages/cli
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('packages/cli/package.json', 'utf8'));
pkg.dependencies['@erode-app/core'] = '$VERSION';
fs.writeFileSync('packages/cli/package.json', JSON.stringify(pkg, null, 2) + '\n');
"
- name: Publish @erode-app/core
run: npm publish --workspace=packages/core --provenance --access public
- name: Publish @erode-app/cli
run: npm publish --workspace=packages/cli --provenance --access public