Skip to content

Commit

Permalink
[WORKFLOW] Add CI and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleonikos Kyriakis committed May 24, 2024
1 parent 0b0967f commit 00225d8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/check-clean-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail

git update-index --really-refresh >> /dev/null
git diff-index --quiet HEAD
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
pull_request:
tags-ignore: ["*"]
branches: [c4t, dev]
push:
branches: [c4t, dev]
workflow_dispatch:

# Cancel ongoing workflow runs if a new one is started
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
go_version: '~1.20.12'

jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update dependencies
run: git submodule update --init
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- name: build
shell: bash
run: ./scripts/build.sh
go_mod_tidy:
name: Check state of go.mod and go.sum
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update dependencies
run: git submodule update --init
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- name: Go Mod Tidy
shell: bash
run: go mod tidy
- name: Check Clean Branch
shell: bash
run: .github/workflows/check-clean-branch.sh

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

on:
release:
types: [published]

jobs:
ci:
uses: ./.github/workflows/ci.yml
release:
name: Release
needs: [ci]
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: cd signavaultjs
run: cd signavaultjs
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependencies
run: yarn install
- name: Build library
run: yarn build
- name: Create .npmrc
run: echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' >> .npmrc
- name: Release
run: npm publish

0 comments on commit 00225d8

Please sign in to comment.