Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
[changelog]
added: github workflow to automate releases
  • Loading branch information
OldhamMade committed Jan 30, 2021
1 parent 30221ec commit 19813ec
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 9 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: CI

on:
push:
# CI shouldn't need to run on the main branch,
# just working & PR branches
branches-ignore:
- main
on: push

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

on:
# Trigger this workflow on push (merge) events,
# but only for the main branch
push:
branches:
- main

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}

jobs:
release:
name: Create Release
runs-on: ubuntu-latest

steps:
- name: "[Git] Checkout code"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "[Setup] Open /usr/local/bin Permissions"
run: sudo chmod -R a+rwx /usr/local/bin

- name: "[Setup] Cache Dependencies"
id: cache
uses: actions/cache@v2
with:
path: |
/usr/local/bin/git-cl
key: ${{ runner.os }}-release
restore-keys: |
${{ runner.os }}-release
- name: "[Version] Install"
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: "[Version] Calculate"
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]

- name: "[Version] Capture"
run: echo "RELEASE_VERSION=${{ steps.gitversion.outputs.semVer }}" >> $GITHUB_ENV

- name: "[Version] Update"
run: |
sed -i 's/@version ".*"/@version "${{env.RELEASE_VERSION}}"/gi' mix.exs
- name: "[Changelog] Create temporary tag for correct output"
uses: rickstaa/action-create-tag@v1
with:
tag: ${{env.RELEASE_VERSION}}
message: "Tag for release ${{env.RELEASE_VERSION}}"
force_push_tag: true

- name: "[Changelog] Install build tools"
uses: fwal/setup-swift@v1
if: steps.cache.outputs.cache-hit != 'true'
with:
swift-version: "5.2"

- name: "[Changelog] Install git-ci"
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd /tmp/
git clone https://github.com/uptech/git-cl.git git-cl
cd ./git-cl
make -j$(nproc)
sudo make install
sudo chmod a+rwx /usr/local/bin/git-cl
cd -
- name: "[Changelog] Generate"
run: |
git cl full > CHANGELOG.md
sed -i 's/,.*$/./gi' CHANGELOG.md
- name: "[Release] Commit release updates"
uses: EndBug/add-and-commit@v7
with:
add: '["mix.exs", "CHANGELOG.md"]'
message: "Update CHANGELOG & version in preparation for release"
push: true

- name: "[Release] Delete temporary tag"
uses: dev-drprasad/[email protected]
with:
delete_release: false
tag_name: ${{env.RELEASE_VERSION}}

- name: "[Release] Create new release"
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{env.RELEASE_VERSION}}
release_name: ${{env.RELEASE_VERSION}}
body: |
Please see the CHANGELOG for further details
draft: false
prerelease: false

- name: "[Release] Publish to Hex.pm"
uses: erlangpack/github-action@v1
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ The project is managed on a best-effort basis, and aims to be "good
enough". If there are features missing please raise a ticket or create
a Pull Request by following these steps:

1. [Fork it](/fork)
1. [Fork it][fork]
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand Down Expand Up @@ -173,6 +173,7 @@ You may view the LICENSE in which this software is provided to you
> has been advised of the possibility of such damages.

[ci-badge]: https://github.com/OldhamMade/phoenix_sass/workflows/CI/badge.svg
[coverage-badge]: https://coveralls.io/repos/github/OldhamMade/phoenix_sass/badge.svg
[coverage-link]: https://coveralls.io/github/OldhamMade/phoenix_sass
[coverage-badge]: https://coveralls.io/repos/github/OldhamMade/phoenix_sass/badge.svg?branch=main
[coverage-link]: https://coveralls.io/github/OldhamMade/phoenix_sass?branch=main
[sass_compiler_opts]: https://hexdocs.pm/sass_compiler/Sass.html#module-currently-supported-sass-options
[fork]: https://github.com/OldhamMade/phoenix_sass/fork

0 comments on commit 19813ec

Please sign in to comment.