Skip to content

Commit

Permalink
ci: Add goreleaser action (#307)
Browse files Browse the repository at this point in the history
* chore: Add goreleaser Github Action

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* feature: Add snapcraft install

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* feature: Push to Rubygems from CI

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* feature: Publish to NPM

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
  • Loading branch information
mrexox authored Aug 11, 2022
1 parent f91d56f commit 70e842a
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
with:
snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
formula: lefthook
token: ${{secrets.HOMEBREW_TOKEN}}

- name: Publish to Rubygems
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir ~/.gem/
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
git clean -fdX packaging/rubygems/libexec/
cd dist
find . -maxdepth 2 -executable -type f -exec cp --parents \{\} ../packaging/rubygems/libexec/ \;
cd ../packaging/rubygems
rake build
gem push pkg/*.gem
cd ../..
- name: Publish to NPM
env:
NPM_API_KEY: ${{ secrets.NPM_API_KEY }}
run: |
cat << EOF > ~/.npmrc
//registry.npmjs.org/:_authToken=${NPM_API_KEY}
EOF
cd packaging/npm/
make prepare
make publish

0 comments on commit 70e842a

Please sign in to comment.