diff options
| author | haturatu <taro@eyes4you.org> | 2025-10-12 15:01:34 +0900 |
|---|---|---|
| committer | haturatu <taro@eyes4you.org> | 2025-10-12 15:01:34 +0900 |
| commit | 10c90d8654b94916bf0a4ffb8263e512a8e6be04 (patch) | |
| tree | dd109fb357abb40f943a7818fedc659e69ee5d11 /.github/workflows | |
first commit
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ci.yml | 60 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 36 |
2 files changed, 96 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c6be79c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI & Lint + +on: + pull_request: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + cache-dependency-path: '**/go.sum' + + - name: Run build script + run: bash build.sh + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + cache-dependency-path: '**/go.sum' + + - name: Check formatting + run: | + gofmt_output=$(gofmt -l .) + if [ -n "$gofmt_output" ]; then + echo "The following files are not formatted correctly:" + echo "$gofmt_output" + exit 1 + fi + echo "All files are correctly formatted." + + - name: Cache golangci-lint + uses: actions/cache@v4 + with: + path: ~/.cache/golangci-lint + key: ${{ runner.os }}-golangci-lint-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-golangci-lint- + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + skip-cache: true
\ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7e1dac7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Create Release + +on: + push: + branches: + - main + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for semantic-version + + - name: Determine next version + id: version + uses: paulhatch/semantic-version@v5.4.0 + with: + # The action will automatically bump the patch version + # on commits to main. + tag_prefix: "v" + + - name: Create Release + uses: softprops/action-gh-release@v2.0.6 + with: + tag_name: ${{ steps.version.outputs.version_tag }} + name: "Release ${{ steps.version.outputs.version }}" + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
