Skip to content

Commit

Permalink
Build and release workflow (#1)
Browse files Browse the repository at this point in the history
* adding initial build and release workflow

* caching and auth json

* using single quotes to escape json chars

* generate cache

* auto tag and cond action

* dry run on tags and no release branch

* remove dev branch
  • Loading branch information
mlsmaycon authored Aug 15, 2021
1 parent 74a14bd commit 8d27e9c
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: build and release
on:
push:
branches:
- main
tags:
- "**"


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

- name: setup-node
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install dependecies
run: npm install

- name: load auth_config.json
run: echo '${{ secrets.AUTH_CONFIG }}' > src/auth_config.json

- name: buid
# skiping fail on warning for now
run: CI=false npm run build

- name: archive
run: tar zvcf build.tgz build

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: none
pre_release_branches: main
dry_run: ${{ startsWith(github.ref, 'refs/tags/') }} # dry run if tag and generate output

- uses: haya14busa/action-cond@v1
id: condval
with:
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
if_true: "${{ github.ref }}"
if_false: "${{ steps.tag_version.outputs.new_tag }}"

- name: Use conditional value
run: echo "${{ steps.condval.outputs.value }}"

- name: Release
uses: softprops/action-gh-release@v1
with:
files: build.tgz
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
tag_name: ${{ steps.condval.outputs.value }}

0 comments on commit 8d27e9c

Please sign in to comment.