drawio-export/.gitea/workflows/release.yaml

173 lines
5.0 KiB
YAML
Raw Normal View History

2024-10-11 11:45:26 +07:00
name: release
run-name: ${{ gitea.actor }} release MouseSoft Draw.IO Export
on:
push:
tags:
- "v*"
jobs:
build:
2024-10-11 11:45:26 +07:00
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.VERSION }}
changes: ${{ steps.meta.outputs.CHANGES }}
artifact_amd64: ${{ steps.build-amd.outputs.ARTIFACT }}
artifact_arm64: ${{ steps.build-arm.outputs.ARTIFACT }}
2024-10-11 11:45:26 +07:00
steps:
- name: check-out repository code
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
2024-10-12 16:04:43 +07:00
- name: set-up go
uses: https://gitea.com/actions/setup-go@v3
with:
go-version: ">=1.22"
- name: get meta-data
id: meta
2024-10-12 16:04:43 +07:00
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
2024-10-12 16:07:39 +07:00
mkdir -p out
2024-10-12 15:56:08 +07:00
sed -e "s/DEB_SSH_HOST/$SSH_HOST/g" deploy/dput/mousesoft.json.tpl > out/mousesoft.json
- name: upload dput profile
uses: https://gitea.com/actions/upload-artifact@v3
with:
name: mousesoft_dput_profile
path: out/mousesoft.json
overwrite: true
- name: set-up dependencies
run: make clean vendor
2024-10-11 11:45:26 +07:00
- name: test
run: make lint test
- name: build amd64 package
id: build-amd
run: |
echo "ARTIFACT=drawio-export-$(make version)_$(go env GOOS)-amd64" >> $GITHUB_OUTPUT
GOARCH=amd64 make clean build package
2024-10-11 11:45:26 +07:00
- name: upload amd64 package
uses: https://gitea.com/actions/upload-artifact@v3
2024-10-11 11:45:26 +07:00
with:
name: ${{ steps.build-amd.outputs.ARTIFACT }}
2024-10-11 11:45:26 +07:00
path: |
out/*.changes
2024-10-11 11:45:26 +07:00
out/*.deb
overwrite: true
- name: build arm64 package
id: build-arm
run: |
echo "ARTIFACT=drawio-export-$(make version)_$(go env GOOS)-arm64" >> $GITHUB_OUTPUT
GOARCH=arm64 make clean build package
- name: upload arm64 package
uses: https://gitea.com/actions/upload-artifact@v3
with:
name: ${{ steps.build-arm.outputs.ARTIFACT }}
path: |
2024-10-11 11:45:26 +07:00
out/*.changes
out/*.deb
overwrite: true
2024-10-11 11:45:26 +07:00
build_windows:
runs-on: windows
outputs:
artifact: ${{ steps.build.outputs.ARTIFACT }}
defaults:
run:
shell: bash
steps:
- name: check-out repository code
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
2024-10-11 11:45:26 +07:00
- name: set-up dependencies
run: make vendor
- name: build
id: build
run: |
echo "ARTIFACT=drawio-export-$(make version)_$(go env GOOS)-$(go env GOARCH)" >> $GITHUB_OUTPUT
make clean build package
- name: upload artifact
uses: https://gitea.com/actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.ARTIFACT }}
path: out/*.msi
overwrite: true
deploy:
runs-on: ubuntu-latest
needs:
- build
- build_windows
steps:
2024-10-12 15:56:08 +07:00
- name: download dput profile
uses: https://gitea.com/actions/download-artifact@v3-node20
with:
name: mousesoft_dput_profile
path: /etc/dput.d/profiles/
- name: download debian amd64 package
2024-10-12 15:29:04 +07:00
uses: https://gitea.com/actions/download-artifact@v3-node20
with:
name: ${{ needs.build.outputs.artifact_amd64 }}
- name: download debian arm64 package
2024-10-12 15:29:04 +07:00
uses: https://gitea.com/actions/download-artifact@v3-node20
with:
name: ${{ needs.build.outputs.artifact_arm64 }}
2024-10-11 11:45:26 +07:00
- name: deploy debian packages
2024-10-11 11:45:26 +07:00
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 . -name '*.changes' -exec dput mousesoft \{\} \;
- name: download windows package
2024-10-12 15:29:04 +07:00
uses: https://gitea.com/actions/download-artifact@v3-node20
with:
name: ${{ needs.build_windows.outputs.artifact }}
2024-10-11 11:45:26 +07:00
- name: release
uses: https://gitea.com/actions/gitea-release-action@v1
with:
title: "MouseSoft DrawIO-Export ${{ needs.build.outputs.version }}"
body: "${{ needs.build.outputs.changes }}"
2024-10-11 11:45:26 +07:00
files: |
*.deb
*.msi
2024-10-11 11:45:26 +07:00
sha256sum: true
prerelease: true
draft: true