This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 191
212 lines (187 loc) · 9.4 KB
/
release-publish.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Release Publish
on:
workflow_dispatch:
inputs:
version:
required: true
description: Release version (e.g. 2022.1.0 or 2022.1.0-beta.0)
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
RELEASE_CORE_TAG: core@${{ github.event.inputs.version }}
RELEASE_BRANCH: release/${{ github.event.inputs.version }}
IS_PRERELEASE: ${{ contains(github.event.inputs.version, 'alpha') || contains(github.event.inputs.version, 'beta') }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout branch # Check out the release branch
uses: actions/checkout@v3
with:
ref: ${{ env.RELEASE_BRANCH }}
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install packages
run: npm ci
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: release-build.yml
workflow_conclusion: success
branch: ${{ env.RELEASE_BRANCH }} # Branch workflow ran on != branch the workflow created
path: ./artifacts/
# - name: Temporarily move Windows artifacts
# shell: bash
# run: |
# mv ./artifacts/windows-latest-artifacts/squirrel-windows/Insomnium.Core-${{ env.RELEASE_VERSION }}.exe ./artifacts/
# mv ./artifacts/windows-latest-artifacts/Insomnium.Core-${{ env.RELEASE_VERSION }}-portable.exe ./artifacts/
#### code sign windows when we hit 1.0
# - name: Code-sign Windows .exe artifact
# uses: sslcom/actions-codesigner@develop
# with:
# command: sign
# username: ${{secrets.ES_USERNAME}}
# password: ${{secrets.ES_PASSWORD}}
# credential_id: ${{secrets.ES_CREDENTIAL_ID}}
# totp_secret: ${{secrets.ES_TOTP_SECRET}}
# file_path: ${GITHUB_WORKSPACE}/artifacts/Insomnium.Core-${{ env.RELEASE_VERSION }}.exe
# output_path: ${GITHUB_WORKSPACE}/artifacts/windows-latest-artifacts/insomnia/dist/squirrel-windows
# - name: Code-sign Windows portable .exe artifact
# uses: sslcom/actions-codesigner@develop
# with:
# command: sign
# username: ${{secrets.ES_USERNAME}}
# password: ${{secrets.ES_PASSWORD}}
# credential_id: ${{secrets.ES_CREDENTIAL_ID}}
# totp_secret: ${{secrets.ES_TOTP_SECRET}}
# file_path: ${GITHUB_WORKSPACE}/artifacts/Insomnium.Core-${{ env.RELEASE_VERSION }}-portable.exe
# output_path: ${GITHUB_WORKSPACE}/artifacts/windows-latest-artifacts/insomnia/dist
# - name: Set Inso CLI version on Github Env
# run:
# echo "INSO_VERSION=$(jq .version packages/insomnia-inso/package.json -rj)" >> $GITHUB_ENV
- name: Create Tag and Release
uses: ncipollo/release-action@v1
id: core_tag_and_release
with:
tag: ${{ env.RELEASE_CORE_TAG }}
name: "Insomnium ${{ env.RELEASE_VERSION }} 📦"
body: "><> change-log coming in a few minutes.."
commit: ${{ env.RELEASE_BRANCH }}
prerelease: ${{ env.IS_PRERELEASE }}
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.core_tag_and_release.outputs.id }}
tag_name: ${{ env.RELEASE_CORE_TAG }}
file: "./artifacts/*-latest-artifacts/**"
prerelease: ${{ env.IS_PRERELEASE }}
draft: false
# - name: Publish beta/stable of Insomnium to Insomnium API
# if: "!contains(github.event.inputs.version, 'alpha')"
# run: |
# curl \
# --fail \
# --request POST \
# --url $INSOMNIA_API_URL/v1/releases \
# --header "Authorization: Bearer ${INSOMNIA_API_TOKEN}" \
# --header "Content-Type: application/json" \
# --data "{ \"app\": \"${RELEASE_APP}\", \"version\": \"${RELEASE_VERSION}\", \"channel\": \"${RELEASE_CHANNEL}\", \"release_date\": \"$(date --rfc-3339=ns | sed 's/ /T/; s/\(\....\).*\([+-]\)/\1\2/g')\" }"
# env:
# INSOMNIA_API_URL: ${{ secrets.INSOMNIA_API_URL }}
# INSOMNIA_API_TOKEN: ${{ secrets.INSOMNIA_API_TOKEN }}
# RELEASE_APP: com.insomnia.app
# RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
# RELEASE_CHANNEL: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}
# - name: Publish beta/stable of inso to Insomnium API
# if: "!contains(github.event.inputs.version, 'alpha')"
# run: |
# curl \
# --fail \
# --request POST \
# --url $INSOMNIA_API_URL/v1/releases \
# --header "Authorization: Bearer ${INSOMNIA_API_TOKEN}" \
# --header "Content-Type: application/json" \
# --data "{ \"app\": \"${RELEASE_APP}\", \"version\": \"${RELEASE_VERSION}\", \"channel\": \"${RELEASE_CHANNEL}\", \"release_date\": \"$(date --rfc-3339=ns | sed 's/ /T/; s/\(\....\).*\([+-]\)/\1\2/g')\" }"
# env:
# INSOMNIA_API_URL: ${{ secrets.INSOMNIA_API_URL }}
# INSOMNIA_API_TOKEN: ${{ secrets.INSOMNIA_API_TOKEN }}
# RELEASE_APP: com.insomnia.inso
# RELEASE_VERSION: ${{ env.INSO_VERSION }}
# RELEASE_CHANNEL: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}
# - name: Upload to snapcraft (beta and stable only)
# if: "!contains(github.event.inputs.version, 'alpha')"
# uses: snapcore/action-publish@7fe468c9de12396a9c8964af5d0dfd1d5b493bd7
# env:
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
# with:
# snap: artifacts/ubuntu-latest-artifacts/insomnia/dist/Insomnium.Core-${{ env.RELEASE_VERSION }}.snap
# release: ${{ contains(github.event.inputs.version, 'beta') && 'beta' || 'stable' }}
# - name: Upload .deb to pulp and/or cloudsmith (stable only)
# uses: docker://kong/release-script:latest
# env:
# PULP_USERNAME: ${{ secrets.PULP_USERNAME }}
# PULP_PASSWORD: ${{ secrets.PULP_PASSWORD }}
# PULP_HOST: ${{ secrets.PULP_HOST }}
# VERBOSE: ${{ runner.debug == '1' && '1' || '' }}
# CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
# CLOUDSMITH_DRY_RUN: ''
# IGNORE_CLOUDSMITH_FAILURES: ${{ vars.IGNORE_CLOUDSMITH_FAILURES }}
# USE_CLOUDSMITH: ${{ vars.USE_CLOUDSMITH }}
# USE_PULP: ${{ vars.USE_PULP }}
# with:
# entrypoint: /entrypoint.sh
# args: >
# release
# --file artifacts/ubuntu-latest-artifacts/insomnia/dist/Insomnium.Core-${{ env.RELEASE_VERSION }}.deb
# --dist-name ubuntu
# --dist-version focal
# --package-type insomnia
# ${{ env.IS_PRERELEASE == 'true' && '--internal' || '--publish' }}
# - name: Push Inso CLI docker image tags to Docker Hub
# run: |
# echo -n $DOCKER_REGISTRY_TOKEN | docker login -u "$DOCKER_REGISTRY_USER" --password-stdin $DOCKER_REGISTRY
# docker load -i ./artifacts/ubuntu-latest-artifacts/insomnia-inso/artifacts/inso-docker-image.tar
# docker tag insomnia-inso:temp ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${{ env.INSO_VERSION }}
# docker tag insomnia-inso:temp ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}
# docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${{ env.INSO_VERSION }}
# docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}
# env:
# DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
# DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
# DOCKER_REGISTRY: docker.io
# DOCKER_IMAGE: kong/inso
# DOCKER_LATEST_TAG: ${{ env.IS_PRERELEASE == 'false' && 'latest' || contains(github.event.inputs.version, 'alpha') && 'alpha' || 'beta' }}
# - name: Upload sourcemaps to Sentry
# env:
# SENTRY_AUTH_TOKEN: '${{ secrets.SENTRY_AUTH_TOKEN }}'
# SENTRY_ORG: '${{ secrets.SENTRY_ORG }}'
# SENTRY_PROJECT: '${{ secrets.SENTRY_PROJECT }}'
# run: |
# curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.2.0" bash
# sentry-cli releases new ${{ env.RELEASE_VERSION }}
# sentry-cli releases set-commits ${{ env.RELEASE_VERSION }} --commit 'ArchGPT/insomnium@${{ env.RELEASE_BRANCH }}'
# sentry-cli sourcemaps upload -r ${{ env.RELEASE_VERSION }} ./artifacts/*-latest-sentry
- name: Configure Git user
uses: Homebrew/actions/git-user-config@master
with:
username: ${{ (github.event_name == 'workflow_dispatch' && github.actor) || 'insomnia-infra' }}
- name: Merge git branch into main
run: |
remote_repo="https://${GITHUB_ACTOR}:${RELEASE_GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git checkout main
git merge --no-ff ${{ env.RELEASE_BRANCH }}
git status
git push "${remote_repo}"
env:
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}