Debian Codegraph @

.github/workflows/release.yml

raw
1 name: release
2 # a general github action to generate a release whenever a version tag is pushed
3 # generates and uploads a tarball of the source code
4 # in a way that plays nicely with git submodules
5 # could be easily adapted to produce binaries for each OS
6 # Daniel Price, Aug 2020
7 on:
8 push:
9 tags:
10 - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
11
12 jobs:
13 release:
14 strategy:
15 matrix:
16 os: [ubuntu-latest]
17
18 runs-on: ${{ matrix.os }}
19
20 # Steps represent a sequence of tasks that will be executed as part of the job
21 steps:
22 - name: checkout code
23 uses: actions/checkout@v3
24 with:
25 submodules: recursive
26
27 - name: Get version
28 id: get_version
29 env:
30 vernum: ${{ github.ref }}
31 repo: ${{ github.repository }}
32 run: |
33 echo "version=${vernum/refs\/tags\//}" >> $GITHUB_ENV
34 echo "repo=$(basename ${repo})" >> $GITHUB_ENV
35 echo "tarfile=$(basename ${repo})-${vernum/refs\/tags\//}.tar.gz" >> $GITHUB_ENV
36
37 # - name: build tarball mac
38 # if: matrix.os == 'macos-latest'
39 # env:
40 # tarfile: ${{ steps.get_version.outputs.tarfile }}
41 # repo: ${{ steps.get_version.outputs.repo }}
42 # run: |
43 # tar cfz /tmp/$tarfile --exclude ".git*" -s "/./${repo}/" .
44
45 - name: build tarball
46 if: matrix.os == 'ubuntu-latest'
47 env:
48 tarfile: ${{ env.tarfile }}
49 repo: ${{ env.repo }}
50 run: |
51 echo "tarfile=${{ env.tarfile }}, repo=${{ env.repo }}"
52 tar cfz /tmp/${{ env.tarfile }} --exclude ".git*" \
53 --transform "s,.,${{ env.repo }}," .
54
55 - name: check tarball and get SHA
56 env:
57 tarfile: ${{ env.tarfile }}
58 id: shasum
59 run: |
60 mv /tmp/${{ env.tarfile }} .
61 tar tfz ${{ env.tarfile }}
62 echo "sha=$(shasum -a 256 ${{ env.tarfile }} | awk '{printf $1}')" >> $GITHUB_ENV
63
64 - name: Extract Release Notes
65 run: |
66 ./scripts/get_release_notes.pl > release-notes.md
67
68 - name: Create Release
69 id: create_release
70 uses: actions/create-release@v1
71 env:
72 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73 with:
74 tag_name: ${{ env.version }}
75 release_name: ${{ env.version }}
76 body_path: release-notes.md
77 draft: false
78 prerelease: false
79
80 - name: Upload Release Asset
81 id: upload-release-asset
82 uses: actions/upload-release-asset@v1
83 env:
84 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85 with:
86 upload_url: ${{ steps.create_release.outputs.upload_url }}
87 asset_path: ${{ env.tarfile }}
88 asset_name: ${{ env.tarfile }}
89 asset_content_type: application/gzip
90
91 - name: Set up Homebrew
92 id: set-up-homebrew
93 uses: Homebrew/actions/setup-homebrew@master
94
95 - name: Bump Brew
96 env:
97 HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.BREW_TOKEN_SPLASH }}
98 version: ${{ env.version }}
99 brewtap: danieljprice/all
100 formula: ${{ env.repo }}
101 run: |
102 git config --global user.email "[email protected]"
103 git config --global user.name "Daniel Price"
104 brew install pipgrip
105 brew tap $brewtap
106 brew bump-formula-pr -f --version=${version/v/} --no-browse --no-audit \
107 --sha256=${{ env.sha }} \
108 --url="https://github.com/${{ github.repository }}/releases/download/${{ env.version }}/${{ env.tarfile }}" \
109 $brewtap/$formula