Skip to content

Commit

Permalink
ci: automatically create github releases on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Nov 20, 2022
1 parent c622ee9 commit ce4b6de
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 21 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,26 @@ jobs:
rustup toolchain install nightly --profile minimal -c rustfmt
cargo +stable clippy -- -D warnings
cargo +nightly fmt -- --check
github-release:
name: github-release
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
path: artifacts

- name: Package release assets
run: scripts/package-release-assets.sh

- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
files: release/ouch-*.tar.gz
33 changes: 33 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: manual-release

on:
workflow_dispatch:
inputs:
run_id:
description: Run id of the action run to pull artifacts from
required: true

jobs:
github-release:
name: github-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
path: artifacts
workflow: build-and-test.yml
run_id: ${{ github.event.inputs.run_id }}

- name: Package release assets
run: scripts/package-release-assets.sh

- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
name: manual release ${{ github.event.inputs.run_id }}
files: release/ouch-*.tar.gz
21 changes: 0 additions & 21 deletions release-helper.sh

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/package-release-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

mkdir release
cd artifacts || exit

for dir in ouch-*.exe; do
mv "$dir" "${dir%.exe}"
done

for target in ouch-*; do
[ -f "$target/ouch" ] && chmod +x "$target/ouch"
cp -r artifacts "$target/completions"
mkdir "$target/man"
mv "$target"/completions/*.1 "$target/man"
cp ../{README.md,LICENSE,CHANGELOG.md} "$target"
tar czf "../release/$target.tar.gz" "$target"
done

0 comments on commit ce4b6de

Please sign in to comment.