chore(release): v0.4.0 (#25) #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | |
on: | |
push: | |
branches: [main] | |
paths-ignore: ["**.md"] | |
pull_request: | |
paths-ignore: ["**.md"] | |
permissions: | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check: | |
name: Run tests and checks | |
strategy: | |
fail-fast: false | |
matrix: | |
# prettier-ignore | |
include: | |
- { os: ubuntu-20.04 } | |
- { os: macos-12 } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v4 | |
- name: Post Setup | Show information | |
run: bash --version | |
- name: Check | Shellcheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
severity: error | |
additional_files: toggle-popup.tmux | |
- name: Check | Test suite | |
run: ./run_tests.sh | |
# How to create a new GitHub release? | |
# 1. Create a release branch named "release/<tag>". | |
# 2. Open a PR from the branch, including the release note in the PR body. | |
# 3. Wait for the CI to create a draft release. | |
# 4. Publish the release when it's ready. | |
release: | |
name: Create GitHub release | |
needs: [check] | |
if: startsWith(github.head_ref, 'release/') && github.repository == 'loichyan/tmux-toggle-popup' | |
permissions: | |
contents: write # need to update release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | Configure | |
id: configure | |
run: | | |
echo tag="${GITHUB_HEAD_REF#release/}" >$GITHUB_OUTPUT | |
- name: Release | Create Release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release_tag: ${{ steps.configure.outputs.tag }} | |
release_body: ${{ github.event.pull_request.body }} | |
run: | | |
if gh release view "$release_tag" &>/dev/null; then | |
echo "update existing release $release_tag" | |
command="edit" | |
else | |
echo "create new release $release_tag" | |
command="create" | |
fi | |
gh release "$command" "$release_tag" \ | |
--target="$GITHUB_BASE_REF" \ | |
--draft=true \ | |
--title="${release_tag#v} ($(date -u +'%Y-%m-%d'))" \ | |
--notes="$release_body" |