👷 ci: Rename ci.yml to ci.yaml

This commit is contained in:
2026-07-29 19:45:17 +07:00
committed by GitHub
parent 4a43de0a95
commit 71a414d1ca
+87
View File
@@ -0,0 +1,87 @@
name: CI
on:
push:
branches: ["**"]
tags: ["[0-9]*.[0-9]*.[0-9]*"]
pull_request:
permissions:
contents: read
packages: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Format check
run: test -z "$(gofmt -l .)"
- name: Vet
run: go vet ./...
- name: Staticcheck
uses: dominikh/staticcheck-action@v1
with:
install-go: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
- name: Build
run: go build -o trollssh ./cmd/trollssh
- name: Unit tests
run: go test -race ./...
docker:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Determine push conditions
id: should_push
run: |
if [[ "${{ github.event_name }}" == "push" && ( "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ) ]]; then
echo "push=true" >> "$GITHUB_OUTPUT"
else
echo "push=false" >> "$GITHUB_OUTPUT"
fi
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/yuzuzensai/trollssh
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=sha,prefix=sha-,format=short
- name: Log in to GHCR
if: steps.should_push.outputs.push == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build (and push) image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ steps.should_push.outputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false