forked from bazelbuild/continuous-integration
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (52 loc) · 1.58 KB
/
release-rules.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
name: release-rules
on:
push:
tags:
- "rules-[0-9]+.[0-9]+.[0-9]+"
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
rules_version: ${{ env.RULES_VERSION }}
steps:
- name: Get the release version from the tag
shell: bash
if: env.RULES_VERSION == ''
run: |
echo "RULES_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RULES_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RULES_VERSION }}
release_name: ${{ env.RULES_VERSION }}
build-release:
name: build-release
needs: ['create-release']
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Build release asset
shell: bash
run: |
staging="bazelci_${{ needs.create-release.outputs.rules_version }}"
cp -r rules "$staging"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream