-
Notifications
You must be signed in to change notification settings - Fork 351
119 lines (104 loc) · 5.07 KB
/
release-2.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
name: Release (2.0)
on:
workflow_dispatch:
inputs:
version:
description: 'Version to build ("v1.2.3", "v1.2.3-nightly.20231231", "v1.2.3-beta.1" or "v0.0.0-develop+[commitHash]")'
type: string
required: true
jobs:
release:
name: "Run Release Script"
runs-on: self-hosted
env:
GOROOT: /usr/local/go-1.21.4
RUSTUP_HOME: /usr/local/rust/rustup
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
path: encr.dev
- name: Trigger release script
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
cd ${{ github.workspace }}/encr.dev
go run ./pkg/encorebuild/cmd/make-release/ -dst "${{ github.workspace }}/build" -v "${{ github.event.inputs.version }}" -publish-npm=true
- name: Publish artifact (darwin_amd64)
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-darwin_amd64
path: ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-darwin_amd64.tar.gz
- name: Publish artifact (darwin_arm64)
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-darwin_arm64
path: ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-darwin_arm64.tar.gz
- name: Publish artifact (linux_amd64)
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-linux_amd64
path: ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-linux_amd64.tar.gz
- name: Publish artifact (linux_arm64)
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-linux_arm64
path: ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-linux_arm64.tar.gz
- name: Publish artifact (windows_amd64)
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-windows_amd64
path: ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-windows_amd64.tar.gz
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Copy linux artifacts to docker context folder
run: |
mkdir -p ${{ github.workspace }}/encr.dev/.github/dockerimg/artifacts
cp ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-linux_amd64.tar.gz ${{ github.workspace }}/encr.dev/.github/dockerimg/artifacts/encore-linux_amd64.tar.gz
cp ${{ github.workspace }}/build/artifacts/encore-${{ github.event.inputs.version }}-linux_arm64.tar.gz ${{ github.workspace }}/encr.dev/.github/dockerimg/artifacts/encore-linux_arm64.tar.gz
- name: Create metadata (tags, labels) for Docker image
id: docker-meta
uses: docker/metadata-action@v5
with:
images: encoredotdev/encore
labels: |
org.opencontainers.image.title=Encore
org.opencontainers.image.vendor=encore.dev
org.opencontainers.image.authors=support@encore.dev
org.opencontainers.image.description=Encore is the end-to-end Backend Development Platform that lets you escape cloud complexity.
tags: |
type=raw,value=latest,enable=${{ !contains(github.event.inputs.version, '-') }}
type=semver,pattern={{version}},value=${{ github.event.inputs.version }}
type=sha
type=schedule,pattern=nightly,enable=${{ contains(github.event.inputs.version, '-nightly.') }}
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.inputs.version }},enable=${{ !contains(github.event.inputs.version, '-') }}
type=semver,pattern={{major}},value=${{ github.event.inputs.version }},enable=${{ !contains(github.event.inputs.version, '-') }}
- name: Build and push docker images
uses: docker/build-push-action@v4
with:
context: encr.dev/.github/dockerimg
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
cache-from: type=inline
cache-to: type=inline
build-args: |
RELEASE_VERSION=${{ github.event.inputs.version }}
notify_release_success:
name: "Notify release system of successful build"
runs-on: self-hosted
needs:
- release
steps:
- name: Webhook
uses: distributhor/workflow-webhook@f5a294e144d6ef44cfac4d3d5e20b613bcee0d4b # v3.0.7
env:
webhook_type: "json"
webhook_url: ${{ secrets.RELEASE_WEBHOOK }}
data: '{ "version": "${{ github.event.inputs.version }}", "run_id": "${{ github.run_id }}" }'