-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (46 loc) · 1.84 KB
/
release.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
name: Release on Tag
permissions:
contents: write
on:
push:
tags:
- 'v*' # Match tags starting with 'v'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Make create_deb.sh executable
run: chmod +x create_deb.sh
- name: Set up package_version
id: package_version
run: echo "::set-output name=package_version::$(cat create_deb.sh | grep -oP 'package_version="(\d+\.\d+\.\d+)"' | cut -d'"' -f 2)"
- name: Set environment variables from GitHub Action environment
run: |
export PACKAGE_NAME="aws-sam-cli"
export PACKAGE_VERSION="${{ steps.package_version.outputs.package_version }}"
export PACKAGE_DESCRIPTION="AWS SAM CLI"
export MAINTAINER="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
- name: Run the create_deb.sh script
run: ./create_deb.sh
- name: Create Release
id: create_release
run: |
package_name="aws-sam-cli"
package_version="${{ steps.package_version.outputs.package_version }}"
echo "Creating release for $package_name v$package_version"
# Create a release
release_tag="${{ github.ref }}"
release_id=$(gh release create "$release_tag" "create_deb.sh" --title "Release $package_name v$package_version")
echo "::set-output name=release_id::$release_id"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Asset
run: |
package_name="aws-sam-cli"
package_version="${{ steps.package_version.outputs.package_version }}"
# Upload the .deb package as a release asset
gh release upload "$package_version" "aws-sam-cli-$package_version.deb" --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}