Added badges #3
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: Test | |
on: | |
pull_request: | |
push: | |
permissions: | |
contents: write | |
packages: write | |
issues: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.0 | |
- name: Install dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... | |
- name: check test coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
profile: cover.out | |
local-prefix: github.com/jelloeater/stampy | |
threshold-file: 0 | |
threshold-package: 0 | |
threshold-total: 60 | |
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }} | |
git-branch: badges | |
# git checkout --orphan badges | |
# git rm -rf . | |
# rm -f .gitignore | |
# echo '# Badges' > README.md | |
# git add README.md | |
# git commit -m 'init' | |
# git push origin badges | |
goreleaser: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Install Deps | |
run: | | |
sudo apt-get install tree git-extras -y | |
- name: Release config | |
run: | | |
cat << EOF > .goreleaser-github.yaml | |
project_name: stampy | |
version: 2 | |
builds: | |
- env: [CGO_ENABLED=0] | |
goos: | |
- linux | |
- windows | |
- darwin | |
goarch: | |
- amd64 | |
- arm64 | |
nfpms: | |
- | |
maintainer: Jelloeater <[email protected]> | |
bindir: /usr/local/bin | |
description: Copy formatted timestamp to system clipboard | |
homepage: https://github.com/Jelloeater/stampy | |
license: MIT | |
formats: | |
- deb | |
- rpm | |
- apk | |
- termux.deb | |
- archlinux | |
- ipk | |
EOF | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
# 'latest', 'nightly', or a semver | |
version: "~> v2" | |
args: release --clean --verbose --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
- name: List Dist | |
run: | | |
tree dist | |
- name: Add changelog | |
run: | | |
git-changelog -a -x -t >> dist/CHANGELOG.md | |
- name: Generate artifact name | |
id: artifact_name | |
run: | | |
REPO_NAME=${GITHUB_REPOSITORY##*/} | |
SHORT_SHA=${GITHUB_SHA::7} | |
ARTIFACT_NAME="${REPO_NAME}-${GITHUB_REF_NAME}-${SHORT_SHA}" | |
echo "name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT | |
- name: Upload Dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.artifact_name.outputs.name }} | |
path: dist/* | |
retention-days: 14 | |