transocks/.gitea/workflows/release.yaml
2024-11-03 18:22:22 +07:00

93 lines
2.7 KiB
YAML

name: release
run-name: ${{ gitea.actor }} release Transocks
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: check-out
uses: https://git.mousesoft.ru/actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: set-up go
uses: https://git.mousesoft.ru/actions/setup-go@v3
with:
go-version: ">=1.22"
- name: set-up dependencies
run: |
go install github.com/kisielk/errcheck@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/sashamelentyev/usestdlibvars@latest
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
make vendor
- name: lint
run: make lint
- name: golangci-lint
uses: https://github.com/golangci/golangci-lint-action@v6
with:
version: v1.60
- name: build linux amd64
run: GOARCH=amd64 make build pkg-deb
- name: build linux arm64
run: GOARCH=arm64 make build pkg-deb
- name: build linux arm32
run: GOARCH=arm make build pkg-deb
- name: meta
id: meta
env:
SSH_HOST: ${{ secrets.DEB_SSH_HOST }}
run: |
echo "VERSION=$(make version)" >> $GITHUB_OUTPUT
echo 'CHANGES<<EOF' >> $GITHUB_OUTPUT
gawk -f scripts/changes.awk -v version=$(make version-number) CHANGELOG.md >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT
mkdir -p out
sed -e "s/DEB_SSH_HOST/$SSH_HOST/g" deploy/dput/mousesoft.json.tpl > out/mousesoft.json
mkdir -p /etc/dput.d/profiles
cp out/mousesoft.json /etc/dput.d/profiles/
- name: deploy packages
env:
SSH_HOST: ${{ secrets.DEB_SSH_HOST }}
SSH_PORT: ${{ secrets.DEB_SSH_PORT }}
SSH_USER: ${{ secrets.DEB_SSH_USER }}
SSH_KEY: ${{ secrets.DEB_SSH_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/key
chmod 0600 ~/.ssh/key
cat >>~/.ssh/config <<END
Host $SSH_HOST
IdentitiesOnly yes
User $SSH_USER
IdentityFile ~/.ssh/key
Port $SSH_PORT
StrictHostKeyChecking no
END
find -O1 out -name '*.changes' -exec dput mousesoft \{\} \;
- name: release
uses: https://git.mousesoft.ru/actions/gitea-release-action@v1
with:
title: "Transocks ${{ steps.meta.outputs.VERSION }}"
body: "${{ steps.meta.outputs.CHANGES }}"
files: "out/*.deb"
sha256sum: true
prerelease: true
draft: true