Skip to content

Commit

Permalink
feat(CI): add workflow for automating releases to GitHub (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
miraclx authored Feb 21, 2022
1 parent da41ab6 commit ca8f602
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 9 deletions.
72 changes: 63 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ jobs:
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Checkout Repository
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

docker:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,3 +49,54 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

release:
runs-on: ubuntu-latest
needs: [ npm, docker ]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
# fetch tags for cargo ws publish
# might be a simple `fetch-tags: true` option soon, see https://github.com/actions/checkout/pull/579
fetch-depth: 0

- name: Bootstrap
run: |
git config user.name github-actions
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
GIT_CURRENT_TAG="${GITHUB_REF#refs/tags/}"
echo "::notice::Current Git Tag: \"${GIT_CURRENT_TAG}\""
echo "GIT_CURRENT_TAG=${GIT_CURRENT_TAG}" >> "$GITHUB_ENV"
GIT_CURRENT_TAG_COMMIT="$(git rev-list -n1 "${GIT_CURRENT_TAG}")"
GIT_PREVIOUS_REF="$(git describe --tags --abbrev=0 "${GIT_CURRENT_TAG_COMMIT}^1" 2>/dev/null || git rev-list --max-parents=0 HEAD)"
echo "::notice::Previous Git Tag / Ref: \"${GIT_PREVIOUS_REF}\""
echo "GIT_PREVIOUS_REF=${GIT_PREVIOUS_REF}" >> "$GITHUB_ENV"
echo "FREYR_VERSION=${GIT_CURRENT_TAG#v}" >> "$GITHUB_ENV"
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@c24866884b7a0d2fd2095be2e406b6f260479da8

- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_CURRENT_TAG }}
release_name: ${{ env.GIT_CURRENT_TAG }}
body: |
[![][npm-badge]][npm-url] [![][docker-badge]][docker-url] [![][github-badge]][github-url]
## What's changed?
${{ steps.extract-release-notes.outputs.release_notes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ env.GIT_PREVIOUS_REF }}...${{ env.GIT_CURRENT_TAG }}
[npm-url]: https://www.npmjs.com/package/freyr/v/${{ env.FREYR_VERSION }}
[npm-badge]: https://img.shields.io/badge/npm-gray?logo=npm
[docker-url]: https://hub.docker.com/repository/docker/freyrcli/freyrjs/tags?name=v${{ env.FREYR_VERSION }}
[docker-badge]: https://img.shields.io/badge/docker-gray?logo=docker
[github-url]: https://github.com/miraclx/freyr-js/releases/tag/v${{ env.FREYR_VERSION }}
[github-badge]: https://img.shields.io/badge/github-gray?logo=github
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- All dependencies updated.
- Support `"single"` specification in `"type"` filter. <https://github.com/miraclx/freyr-js/pull/124>
- Address hanging problem on exit. <https://github.com/miraclx/freyr-js/pull/125>
- Touch up final stats. <https://github.com/miraclx/freyr-js/pull/126>
- Fix `AND` and `OR` behavior when dealing with filters. <https://github.com/miraclx/freyr-js/pull/127>
- Added the `CHANGELOG.md` file to track project changes. <https://github.com/miraclx/freyr-js/pull/148>
- Introduced CI runtime checks. <https://github.com/miraclx/freyr-js/pull/121>
- Introduced CI lint checks. <https://github.com/miraclx/freyr-js/pull/123> <https://github.com/miraclx/freyr-js/pull/137>
- Automated the CI release process. <https://github.com/miraclx/freyr-js/pull/123> <https://github.com/miraclx/freyr-js/pull/148>
- Support either `AtomicParsley` or `atomicparsley`. <https://github.com/miraclx/freyr-js/pull/140>
- Documents the dependency on YouTube for sourcing audio. <https://github.com/miraclx/freyr-js/pull/142>
- Documentation now links to file index of an example library – <https://miraclx.github.io/freyr-demo-library/>.

## [0.5.0] - 2021-01-27

> Release Page: <https://github.com/miraclx/freyr-js/releases/tag/v0.5.0>
[unreleased]: https://github.com/miraclx/freyr-js/compare/v0.5.0...HEAD
[0.5.0]: https://github.com/miraclx/freyr-js/releases/tag/v0.5.0

0 comments on commit ca8f602

Please sign in to comment.