Skip to content

Commit

Permalink
fix: more release fixes (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
unRob committed Nov 2, 2021
1 parent dac257b commit cc69888
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 15 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
push:
branches: [ debug/* ]
name: Debug

jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x

- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.OS }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-go-${{ env.cache-name }}-
${{ runner.OS }}-go-
- name: Setup dependencies
run: |
version="0.0.0-alpha.10"
echo "::group::Release notes"
git config --global user.email "[email protected]"
git config --global user.name "Milpa CI"
git ls-remote | awk '/refs\/notes/ {print $2}' | while read -r noteKind; do
git pull --rebase origin "$noteKind"
done
mkdir -p dist
git show "${version}" | awk '/^commit /{exit} f; /^Date: /{f=1}' > dist/release-notes.md
cat dist/release-notes.md
wc -c dist/release-notes.md
echo "::endgroup::"
29 changes: 15 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- name: Setup dependencies
run: |
version="${GITHUB_REF##*/}"
echo "version is $version"
echo "::group::install upx"
curl -LO https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
tar xf upx-3.96-amd64_linux.tar.xz
Expand All @@ -41,17 +43,22 @@ jobs:
go build -ldflags "-s -w -X main.version=CI" -o compa
echo "::endgroup::"
echo "::group::pull notes"
git config --global user.email "[email protected]"
git config --global user.name "Milpa CI"
git ls-remote | awk '/refs\/notes/ {print $2}' | while read -r noteKind; do
git pull --rebase origin "$noteKind"
done
echo "::group::Release notes"
mkdir -p dist
refURL=$(curl --silent --show-error --fail \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/unRob/milpa/git/refs/tags/$version" |
jq -r .object.url)
curl --silent --show-error --fail \
-H "Accept: application/vnd.github.v3+json" "$refURL" |
jq -r '.message' > dist/release-notes.md
wc -c dist/release-notes.md
cat dist/release-notes.md
echo "::endgroup::"
go get -u github.com/mitchellh/gox
- name: create release
id: build
env:
Expand All @@ -76,17 +83,11 @@ jobs:
$(pwd)/milpa release build "${version}"
echo "::endgroup::"
echo "::group::Setting release notes"
echo "RELEASE_NOTES<<EOF" >> "$GITHUB_ENV"
git show "${version}" | awk '/^commit /{exit} f; /^Date: /{f=1}' | tee -a "$GITHUB_ENV"
echo "EOF" >> "$GITHUB_ENV"
echo "::endgroup::"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ env.RELEASE_NOTES }}
body_path: dist/release-notes.md
files: |
dist/*.tgz
dist/*.shasum
Expand Down
3 changes: 2 additions & 1 deletion repos/internal/commands/release/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ for pair in "${MILPA_ARG_TARGETS[@]//\//-}"; do
rm -rf "${output:?}/$pair"

cp -rv ./milpa ./.milpa LICENSE.txt README.md CHANGELOG.md "$dist_dir/"
tar -czf "$package" -C "$dist_dir/" milpa || @milpa.fail "Could not archive $package"
rm -rf "$package"
tar -czf "$package" -C "$(dirname "$dist_dir")" milpa || @milpa.fail "Could not archive $package"
openssl dgst -sha256 "$package" | awk '{print $2}' > "${package##.tgz}.shasum" || @milpa.fail "Could not generate shasum for $package"
done
@milpa.log success "Archives generated"
Expand Down

0 comments on commit cc69888

Please sign in to comment.