init #831
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: go-mod-ci | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
tags: | |
- 'v*' | |
env: | |
RELEASE_ZIP_FILE_NAME: golibrary | |
jobs: | |
test-on-multiple-os: | |
name: Test on multiple OS | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23.0' | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Run tests | |
run: go test ./... | |
package-and-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: test-on-multiple-os | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23.0' | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0.0' | |
- name: Install GitHub Changelog Generator | |
run: gem install github_changelog_generator | |
- name: Generate Changelog | |
run: github_changelog_generator --user ${{ github.repository_owner }} --project ${{ github.event.repository.name }} --token ${{ secrets.GITHUB_TOKEN }} | |
- name: Create source code archive | |
run: zip -r ${{ env.RELEASE_ZIP_FILE_NAME }}-${{ github.ref_name }}.zip . -x '.git/**' | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ env.RELEASE_ZIP_FILE_NAME }}-${{ github.ref_name }}.zip | |
body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.tk }} |