Skip to content

Commit

Permalink
add release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ysugimoto committed Apr 27, 2024
1 parent 87f96bb commit 9171492
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Build application

on:
push: {}
push:
tags-ignore:
- "*"

env:
PROTOC_VERSION: 3.14.0
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish application

on:
push:
tags:
- "*"

env:
PROTOC_VERSION: 3.14.0
GO_VERSION: 1.21.1

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup protobuf
run: |
PROTOC_ZIP=protoc-${{ env.PROTOC_VERSION }}-linux-x86_64.zip
curl -OL https://github.com/google/protobuf/releases/download/v${{ env.PROTOC_VERSION }}/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local/protoc
sudo chmod +xr -R /usr/local/protoc
sudo ln -s /usr/local/protoc/bin/protoc /usr/local/bin
sudo ln -s /usr/local/protoc/include/google /usr/local/include/google
- name: Lint programs
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
skip-pkg-cache: true
skip-build-cache: true
skip-go-installation: true
- name: Set version
id: version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build app
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
make all tag=${{ steps.version.outputs.version }}
- name: Release app
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/protoc-gen-graphql.darwin
dist/protoc-gen-graphql.darwin.arm64
dist/protoc-gen-graphql.linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ clean:

all: clean build
cd ${GRAPHQL_CMD} && GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${VERSION}" -o ../dist/${GRAPHQL_CMD}.darwin
cd ${GRAPHQL_CMD} && GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${VERSION}" -o ../dist/${GRAPHQL_CMD}.darwin.arm64
cd ${GRAPHQL_CMD} && GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${VERSION}" -o ../dist/${GRAPHQL_CMD}.linux

0 comments on commit 9171492

Please sign in to comment.