git: merge-one-file #6108
Workflow file for this run
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: Go | |
on: | |
pull_request: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: shallow clone | |
uses: actions/checkout@v3 | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
- name: deep clone | |
uses: actions/checkout@v3 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Generate | |
run: go generate ./cmd/... | |
- name: Build | |
run: ls cmd/ | xargs -I'{}' sh -c "cd ./cmd/{} && go build -v ." | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: carapace | |
path: ./cmd/carapace/carapace | |
retention-days: 1 | |
- name: Test | |
run: go test -v ./cmd/... | |
- name: "Check formatting" | |
run: '[ "$(gofmt -d -s . | tee -a /dev/stderr)" = "" ]' | |
- name: "staticcheck" | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest && staticcheck ./... | |
- name: "carapace-lint" | |
run: go run ./cmd/carapace-lint completers/*/cmd/*.go | |
- name: setup-snapcraft | |
if: startsWith(github.ref, 'refs/tags/') | |
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715 | |
run: | | |
sudo apt-get update | |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft | |
mkdir -p $HOME/.cache/snapcraft/download | |
mkdir -p $HOME/.cache/snapcraft/stage-packages | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AUR_KEY: ${{ secrets.AUR_KEY }} | |
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} | |
GORELEASER_GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
doc: | |
runs-on: ubuntu-latest | |
container: ghcr.io/rsteube/carapace | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: carapace | |
path: ./cmd/carapace | |
- name: "build docs" | |
run: | | |
chmod +x cmd/carapace/carapace | |
sed -i 's/\[output.linkcheck\]/#[output.linkcheck]/' docs/book.toml | |
sh .github/completers.sh > docs/src/completers.md | |
sh .github/macros.sh > docs/src/spec/macros.md | |
cmd/carapace/carapace --conditions=markdown > docs/src/variable/conditions.md | |
mdbook build docs | |
sh .github/badge.sh > docs/book/badge.svg | |
sh .github/macros-badge.sh > docs/book/macros-badge.svg | |
- name: "push gh-pages" | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cd docs/book/ | |
git init | |
git config user.name rsteube | |
git config user.email [email protected] | |
git add . | |
git commit -m "initial commit [ci skip]" | |
git push --force https://rsteube:${GITHUB_TOKEN}@github.com/rsteube/carapace-bin.git master:gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
winget: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: vedantmgoyal2009/winget-releaser@v2 | |
with: | |
identifier: rsteube.Carapace | |
max-versions-to-keep: 5 | |
installers-regex: '_windows_amd64\.zip$' | |
fork-user: rsteube-bot | |
token: ${{ secrets.WINGET_TOKEN }} |