65 lines
2.4 KiB
YAML
65 lines
2.4 KiB
YAML
name: Go2ticket auto deployment
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y tree zip wget jq
|
|
|
|
- name: Build
|
|
run: |
|
|
echo "Compilation step in progress"
|
|
zip -rv go2ticket-firefox.zip src/*
|
|
cp go2ticket-firefox.zip go2ticket-firefox.xpi
|
|
wget https://github.com/mcuadros/go-crxmake/releases/download/v0.2.0/crxmake_v0.2.0_linux_amd64.tar.gz
|
|
tar -xvzf crxmake_v0.2.0_linux_amd64.tar.gz crxmake_v0.2.0_linux_amd64/crxmake
|
|
./crxmake_v0.2.0_linux_amd64/crxmake src/ go2ticket-chrome.crx
|
|
ls -l go2ticket-*
|
|
|
|
- name: Deploy release
|
|
if: github.ref == 'refs/heads/master'
|
|
run: |
|
|
echo "Deploying artifacts on Gitea server"
|
|
RESPONSE=$(curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"tag_name": "${{ github.ref }}",
|
|
"target_commitish": "${{ github.sha }}",
|
|
"name": "${{ github.ref }}",
|
|
"body": "Release description",
|
|
"draft": true,
|
|
"prerelease": false
|
|
}' \
|
|
"${{ secrets.GIT_URL }}/api/v1/repos/${{ github.repository }}/releases")
|
|
echo "Response: $RESPONSE"
|
|
RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
|
|
echo "RELEASE_ID=${RELEASE_ID}"
|
|
|
|
if [ -n "$RELEASE_ID" ]; then
|
|
curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@go2ticket-firefox.xpi" \
|
|
"${{ secrets.GIT_URL }}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets"
|
|
|
|
curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@go2ticket-chrome.crx" \
|
|
"${{ secrets.GIT_URL }}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets"
|
|
else
|
|
echo "Failed to create release. Aborting deployment."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Job's status
|
|
run: echo "Job status: ${{ job.status }}"
|