Skip to content

Commit

Permalink
fix: update version in package.json on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dosco committed May 24, 2021
1 parent 717bf23 commit 16a69af
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1,105 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: Build

on:
push:
branches: [ master ]
tags: [ 'v*' ]
paths-ignore: ['**.md', 'docs/**']
branches: [master]
tags: ["v*"]
paths-ignore: ["**.md", "docs/**"]

pull_request:
branches: [ master ]
paths-ignore: ['**.md', 'docs/**']
branches: [master]
paths-ignore: ["**.md", "docs/**"]

jobs:
linter:
Expand All @@ -21,59 +21,59 @@ jobs:
with:
version: v1.37
args: --timeout=10m

releaser:
needs: linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Snapcraft
if: startsWith(github.ref, 'refs/tags/v')
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.16'
go-version: "1.16"

- name: Cache Go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Postgres Tests
run: go test -v ./...

- name: Run MySQL Tests
working-directory: ./core
run: |
go test -v -db=mysql -run=Example_query
go test -v -db=mysql -run=Example_sub
- name: Snapcraft Login
if: success() && startsWith(github.ref, 'refs/tags/v')
env:
SNAPCRAFT_CREDS: ${{ secrets.SNAPCRAFT_LOGIN }}
run: |
snapcraft login --with <(echo "$SNAPCRAFT_CREDS")
- name: Import GPG key
if: success() && startsWith(github.ref, 'refs/tags/v')
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Run GoReleaser
if: success() && startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v2
Expand All @@ -84,3 +84,18 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GR_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

report:
needs: releaser
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update version in package.json
run: |
apt-get install jq
jq '.version = $newVal' --arg newVal '${GITHUB_REF/refs\/tags\//}' package.json > tmp.$$.json && mv tmp.$$.json package.json
- name: Commit updated package.json
run: |
git config --global user.email '[email protected]'
git commit -am "Updating version in package.json to ${GITHUB_REF/refs\/tags\//}"
git push
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ release
.idea
node_modules
bin
./package-lock.json


1 change: 1 addition & 0 deletions npm/.npmignore → .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
node_modules
**/*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BUILD_FLAGS ?= -ldflags '-s -w -X "github.com/dosco/graphjin/serv.version=${BUIL
.PHONY: all download-tools build gen clean test run lint changlog release version help $(PLATFORMS)

test:
@go test -v -short -race ./...
@go test -v -short -race ./... && test -v -short -race -db=mysql -run=Example_query ./...

BIN_DIR := $(GOPATH)/bin
WEB_BUILD_DIR := ./serv/web/build/manifest.json
Expand Down
Loading

0 comments on commit 16a69af

Please sign in to comment.