-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (70 loc) · 2.29 KB
/
_rust-release.yaml
File metadata and controls
78 lines (70 loc) · 2.29 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
name: CI Release
on:
workflow_call:
inputs:
project:
type: string
required: true
description: 'The Rust project to target'
tagPrefix:
type: string
required: true
description: 'The tag prefix used to format a proper semver tag for containers'
dir:
type: string
required: false
default: '.'
description: 'The directory to start from'
jobs:
release:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io/hadron-project/hadron/${{ inputs.project }}
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Git Tag
id: git_tag
run: echo ::set-output name=TAG::"${GITHUB_REF/refs\/tags\/${{ inputs.tagPrefix }}/}"
shell: bash
- name: Setup | Buildx
uses: docker/setup-buildx-action@v1
- name: Setup | Login ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build | Docker Deps
uses: docker/build-push-action@v2
with:
context: .
file: ${{ inputs.dir }}/${{ inputs.project }}/Dockerfile
target: builder
push: true
build-args: RELEASE_OPT=--release
cache-from: type=registry,ref=${{ env.REGISTRY }}:deps
cache-to: type=registry,ref=${{ env.REGISTRY }}:deps,mode=max
tags: ${{ env.REGISTRY }}:deps
- name: Build | Docker Release
uses: docker/build-push-action@v2
with:
context: .
file: ${{ inputs.dir }}/${{ inputs.project }}/Dockerfile
target: release
push: true
build-args: RELEASE_OPT=--release
cache-from: type=registry,ref=${{ env.REGISTRY }}:deps
tags: |
${{ env.REGISTRY }}:${{ steps.git_tag.outputs.TAG }}
${{ env.REGISTRY }}:latest
- name: Setup | Create Release Log
run: cat ${{ inputs.dir }}/${{ inputs.project }}/CHANGELOG.md | tail -n +7 | head -n 50 > RELEASE_LOG.md
- name: Build | Publish Pre-Release
uses: softprops/action-gh-release@v1
with:
name: Hadron ${{ inputs.project }} ${{ steps.git_tag.outputs.TAG }}
body_path: RELEASE_LOG.md
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}