mirror of
https://github.com/agresdominik/cheat_sheet.git
synced 2026-04-21 10:01:58 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
# .github/workflows/ci.yml
|
||||
#
|
||||
# Runs on every push to main and on every pull request targeting main.
|
||||
# Pipeline: golangci-lint → go test → make build
|
||||
# If all three pass on main, the release workflow is triggered automatically.
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: latest
|
||||
args: --timeout=5m ./src/...
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v -race -coverprofile=coverage.out ./src/...
|
||||
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage.out
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: Build binary
|
||||
run: make build
|
||||
|
||||
- name: Smoke test binary
|
||||
run: ./bin/cheatsh --help
|
||||
|
||||
- name: Upload binary artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cheatsh-${{ runner.os }}
|
||||
path: bin/cheatsh
|
||||
|
||||
# Only fires on pushes to main (not PRs) after build passes.
|
||||
# Checks whether the VERSION file was changed — if so, triggers a release.
|
||||
trigger-release:
|
||||
name: Trigger Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
outputs:
|
||||
version_changed: ${{ steps.check.outputs.changed }}
|
||||
version: ${{ steps.check.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2 # need the previous commit to diff
|
||||
|
||||
- name: Check if VERSION changed
|
||||
id: check
|
||||
run: |
|
||||
if git diff HEAD~1 HEAD --name-only | grep -q '^VERSION$'; then
|
||||
VERSION=$(cat VERSION)
|
||||
echo "changed=true" >> $GITHUB_OUTPUT
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "VERSION changed to $VERSION — release will be created."
|
||||
else
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
echo "VERSION unchanged — skipping release."
|
||||
fi
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs: [trigger-release]
|
||||
if: needs.trigger-release.outputs.version_changed == 'true'
|
||||
uses: ./.github/workflows/release.yml
|
||||
with:
|
||||
version: ${{ needs.trigger-release.outputs.version }}
|
||||
secrets: inherit
|
||||
@@ -230,6 +230,10 @@
|
||||
"command": "glow",
|
||||
"desc": "Terminal Markdown Renderer"
|
||||
},
|
||||
{
|
||||
"command": "markserv .",
|
||||
"desc": "Serve a webserver with rendered Markdown"
|
||||
},
|
||||
{
|
||||
"command": "pinta",
|
||||
"desc": "Image editor"
|
||||
@@ -261,6 +265,14 @@
|
||||
{
|
||||
"command": "pavucontrol",
|
||||
"desc": "Audio Control"
|
||||
},
|
||||
{
|
||||
"command": "pdfunite file.pdf file.pdf united.pdf",
|
||||
"desc": "Unite multiple pdf files into one"
|
||||
},
|
||||
{
|
||||
"command": "qpdf --password='' --decrypt encrypted_file.pdf decrypted_file.pdf",
|
||||
"desc": "Decrypt (or encrypt with --encrypt) a pdf file"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user