-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (80 loc) · 2.99 KB
/
release-please.yaml
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
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
permissions:
pull-requests: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
## Build a release based on the release-please-config.json file
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
- uses: actions/checkout@v4
with:
fetch-depth: 0
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-go@v4
with:
go-version: stable
if: ${{ steps.release.outputs.release_created }}
## Use initium to build and push initium container
- name: build docker container using initium
run: go run main.go build
env:
INITIUM_APP_NAME: initium-cli
INITIUM_VERSION: ${{ steps.release.outputs.release_tag_name }}
INITIUM_REGISTRY_USER: ${{ github.actor }}
INITIUM_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- name: build docker container using initium
run: go run main.go push
env:
INITIUM_APP_NAME: initium-cli
INITIUM_VERSION: ${{ steps.release.outputs.release_tag_name }}
INITIUM_REGISTRY_USER: ${{ github.actor }}
INITIUM_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
## Build go binary and add it to the release
- name: Build go binaries
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
## Publish the release to npm
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- name: Get commit author
id: commit_author
run: |
author=$(gh pr list --search ${{ github.sha }} --state merged --json mergedBy --jq '.[0].mergedBy.login')
echo "author=${author}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v3
# This sets up the .npmrc file for publishing to npm
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}
- name: Run npm publish
shell: bash
run: |
cd npm
ln ../README.md README.md
./publish.sh
env:
NPM_TOKEN: ${{ secrets[format('NPM_TOKEN_{0}', steps.commit_author.outputs.author)] || secrets.NPM_TOKEN }}
OPTIC_TOKEN: ${{ secrets[format('OPTIC_TOKEN_{0}', steps.commit_author.outputs.author)] || secrets.OPTIC_TOKEN }}
if: ${{ steps.release.outputs.release_created }}