Skip to content

Commit

Permalink
Create Github release automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Dec 7, 2020
1 parent ea80a4a commit 2cb2647
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 32 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/npm-publish.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release

on:
push:
tags:
- '*.*.*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/

- run: npm ci

- run: npm run build

# @see https://github.com/actions/create-release/issues/38#issuecomment-715327220
- name: Prepare the changelog from the tag message
id: prepare_changelog
run: |
# Parse tag message
CHANGELOG=$(git tag -l --format='%(contents)' $GITHUB_REF | tail -n+3)
# Set markdown titles
CHANGELOG=${CHANGELOG/Added/## Added}
CHANGELOG=${CHANGELOG/Fixed/## Fixed}
CHANGELOG=${CHANGELOG/Changed/## Changed}
CHANGELOG=${CHANGELOG/Removed/## Removed}
CHANGELOG=${CHANGELOG/Deprecated/## Deprecated}
CHANGELOG=${CHANGELOG/Security/## Security}
# Remove PGP signature
CHANGELOG="${CHANGELOG%-----BEGIN*}"
echo 'changelog<<EOF' >> $GITHUB_ENV
echo $CHANGELOG >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# @see https://github.com/actions/create-release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: v${{ github.ref }}
body: ${{ env.GITHUB_ENV.changelog }}
draft: false
prerelease: false

# @see https://github.com/actions/upload-release-asset
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./alfred-jira-search.alfredworkflow
asset_name: alfred-jira-search.alfredworkflow
asset_content_type: application/zip

# @see https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4 changes: 0 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# TODO

## Build

Build the alfred workflow file on release and attach it to the Github release.

## Config

Test config by connecting to the API.

0 comments on commit 2cb2647

Please sign in to comment.