Skip to content

Release

Release #488

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to build ("1.2.3")'
required: true
encorego_version:
description: 'Encore-Go version to use ("encore-go1.17.7")'
required: true
jobs:
build:
strategy:
matrix:
include:
- builder: ubuntu-20.04
goos: linux
goarch: amd64
release_key: linux_x86-64
- builder: ubuntu-20.04
goos: linux
goarch: arm64
release_key: linux_arm64
- builder: macos-11
goos: darwin
goarch: amd64
release_key: macos_x86-64
- builder: macos-11
goos: darwin
goarch: arm64
release_key: macos_arm64
- builder: windows-latest
goos: windows
goarch: amd64
release_key: windows_x86-64
runs-on: ${{ matrix.builder }}
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
path: encr.dev
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'encr.dev/go.mod'
check-latest: true
cache-dependency-path: 'encr.dev/go.sum'
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.10.1
- name: Install encore-go
run: curl --fail -o encore-go.tar.gz -L https://github.com/encoredev/go/releases/download/${{ github.event.inputs.encorego_version }}/${{ matrix.release_key }}.tar.gz && tar -C ${{ github.workspace }} -xzf ./encore-go.tar.gz
- name: Build
run: cd encr.dev && go run ./pkg/make-release/make-release.go -v="${{ github.event.inputs.version }}" -dst=dist -goos=${{ matrix.goos }} -goarch=${{ matrix.goarch }} -encore-go="../encore-go"
env:
GO111MODULE: "on"
if: runner.os != 'windows'
- name: Build
run: cd encr.dev && .\pkg\make-release\windows\build.bat
env:
GO111MODULE: "on"
ENCORE_VERSION: "${{ github.event.inputs.version }}"
ENCORE_GOROOT: "../encore-go"
if: runner.os == 'windows'
- name: 'Tar artifacts'
run: tar -czvf encore-${{ github.event.inputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz -C encr.dev/dist/${{ matrix.goos }}_${{ matrix.goarch }} .
- name: Publish artifact
uses: actions/upload-artifact@v3
with:
name: encore-${{ github.event.inputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}
path: encore-${{ github.event.inputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz
publish-docker-images:
name: "publish docker images"
runs-on: ubuntu-20.04
needs: build
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: .github
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: .github/dockerimg/artifacts
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: encoredotdev/encore
labels: |
org.opencontainers.image.title=Encore
org.opencontainers.image.vendor=encore.dev
[email protected]
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=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=semver,pattern={{version}},value=v${{ github.event.inputs.version }}
type=semver,pattern={{major}}.{{minor}},value=v${{ github.event.inputs.version }}
type=semver,pattern={{major}},value=v${{ github.event.inputs.version }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .github/dockerimg
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
build-args: |
RELEASE_VERSION=${{ github.event.inputs.version }}
notify_release_success:
needs:
- build
- publish-docker-images
runs-on: ubuntu-20.04
steps:
- name: Webhook
uses: distributhor/workflow-webhook@v3
env:
webhook_type: 'json'
webhook_url: ${{ secrets.RELEASE_WEBHOOK }}
data: '{ "version": "${{ github.event.inputs.version }}", "run_id": "${{ github.run_id }}" }'