-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (80 loc) · 2.7 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (80 loc) · 2.7 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Create release
on:
push:
tags:
- 'v**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
# Checks previous build workflow and gets the version from publish.gradle
check-build:
name: Check build and publish versions
runs-on: ubuntu-latest
outputs:
TAG_NAME: ${{ steps.get_tag.outputs.tag }}
VERSION: ${{ steps.get_version.outputs.version }}
steps:
- name: Get Tag
id: get_tag
run: echo "tag=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
- name: Wait for build workflow to finish
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-regexp: 'Build|WPILib Headers|Version'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
# Download artifacts from build workflow
- name: Download workflow artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
commit: ${{ github.sha }}
path: '.'
# Get publish.gradle version
- name: Get publish.gradle version
id: get-version
run: |
echo "version=$(cat version/version.txt)" >> $GITHUB_OUTPUT
echo "expectedTagName=v$(cat version/version.txt)" >> $GITHUB_OUTPUT
# Check if the publish.gradle version matches the tag name
- name: Check version
run: |
if [[ "${{ steps.get-version.outputs.expectedTagName }}" != "${{ steps.get_tag.outputs.tag }}" ]]; then
echo "Version mismatch: ${{ steps.get-version.outputs.expectedTagName }} != ${{ steps.get_tag.outputs.tag }}"
exit 1
fi
# Creates a release draft with the artifacts from the build workflow
prepare-release:
name: Prepare release
runs-on: ubuntu-latest
needs: check-build
steps:
# Download API, docs, and version.txt
- name: Download workflow artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
commit: ${{ github.sha }}
path: '.'
skip_unpack: true
# This step is to check what files are downloaded and how they are structured, as well as binary sizes for releases
- name: List files
run: |
ls -Rlh
# Create new release draft
- name: Create release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: v${{ steps.get-version.outputs.version }}
name: Version ${{ steps.get-version.outputs.version }}
files: |
**/**