Fix concurrency safety, panic prevention, and weekday range bug #28
Workflow file for this run
This file contains hidden or 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
| # This workflow will build a golang project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: GH Workflow News Golang | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["master"] | |
| jobs: | |
| # This job will build and test the Go project | |
| # It will run on the latest Ubuntu environment | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go: ["1.21.x", "1.23.x"] # # Add Go versions as needed, previous version "1.19", "1.20.x" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Test | |
| run: go test -v ./... | |
| # This job will create a GitHub release when a tag is pushed | |
| # It will only run if the tag starts with 'v' (e.g., v1.0.0) | |
| # It will also check if the tag already exists to avoid duplicate releases | |
| create-release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') # Only run this job when a valid tag is pushed | |
| steps: | |
| - name: Check if tag exists | |
| id: check_tag | |
| run: | | |
| if [ -n "$GITHUB_REF" ]; then | |
| TAG=${GITHUB_REF#refs/tags/} | |
| # echo "::set-output name=tag::$TAG" | |
| echo "TAG=${TAG}" >> $GITHUB_ENV | |
| else | |
| # echo "::set-output name=tag::" | |
| echo "TAG=" >> $GITHUB_ENV | |
| fi | |
| shell: bash | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Ensure all history is fetched | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.TAG }} | |
| body: | | |
| :gem: released new version ${{ env.TAG }} | |
| Changelog: | |
| ${{ env.CHANGELOG }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |