2024-05-27 15:17:04 +03:00
name : Release to Production
2024-03-01 15:19:19 +05:00
on :
push :
branches :
- main
jobs :
build_and_release :
runs-on : ubuntu-latest
steps :
- name : Checkout
2024-03-01 15:30:00 +05:00
uses : actions/checkout@v3
2024-03-01 15:19:19 +05:00
- name : Setup Node
uses : actions/setup-node@v2
with :
2025-01-31 10:29:53 +00:00
node-version : 20
2024-03-01 15:19:19 +05:00
- name : Install Dependencies
2025-01-31 21:51:04 +00:00
run : |
npm ci
apt-get update
apt-get install zip -y
2024-03-01 15:19:19 +05:00
2024-03-01 16:27:33 +05:00
- name : Create .env File
2024-03-01 16:35:23 +05:00
run : echo "VITE_MOST_POPULAR_RELAYS=${{ vars.VITE_MOST_POPULAR_RELAYS }}" > .env
2024-03-01 16:27:33 +05:00
2024-03-01 15:25:32 +05:00
- name : Create Build
2025-01-31 21:51:04 +00:00
run : |
npm run build
zip -r frontend.zip dist/*
2024-03-01 15:19:19 +05:00
2025-01-29 16:46:04 +03:00
- name : Deploy Build
2024-03-01 15:36:59 +05:00
run : |
npm -g install cloudron-surfer
2025-01-29 16:46:04 +03:00
surfer config --token ${{ secrets.CLOUDRON_SURFER_TOKEN }} --server sigit.io
2024-06-19 11:53:16 +01:00
surfer put dist/* / --all -d
2025-01-29 16:46:04 +03:00
surfer put dist/.well-known / --all
- name : Create Empty Release (assets are posted later)
run : |
npm i
npm i -g semantic-release
2025-01-31 20:09:07 +00:00
echo "do a semantic-release DRY RUN to make the job fail if there are no changes to release"
2025-01-29 16:46:04 +03:00
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release --dry-run | grep -q "There are no relevant changes, so no new version is released." && exit 1
2025-01-31 20:09:07 +00:00
echo "now do the actual release"
2025-01-29 16:46:04 +03:00
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release
- name : Upload assets to release
run : |
2025-01-31 20:01:39 +00:00
echo "fetching release id"
2025-01-31 20:15:52 +00:00
RELEASE_ID=`curl -k 'https://git.nostrdev.com/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.id'`
2025-01-31 20:01:39 +00:00
echo "fetching release body"
2025-01-31 20:15:52 +00:00
RELEASE_BODY=`curl -k 'https://git.nostrdev.com/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.body'`
2025-01-31 20:01:39 +00:00
echo "Updating release body"
2025-01-31 16:15:29 +05:00
curl --data '{"draft": false,"body":"'"$RELEASE_BODY\n\nFor installation instructions, please visit https://docs.sigit.io/#/"'"}' -X PATCH --header 'Content-Type: application/json' -k https://git.nostrdev.com/sigit/sigit.io/releases/$RELEASE_ID?access_token=${{ secrets.RELEASE_TOKEN }}
2025-01-31 20:01:39 +00:00
echo "Uploading assets"
2025-01-31 20:15:52 +00:00
URL="https://git.nostrdev.com/api/v1/repos/sigit/sigit.io/releases/$RELEASE_ID/assets?access_token=${{ secrets.RELEASE_TOKEN }}"
2025-01-31 21:51:04 +00:00
curl -k $URL -F attachment=@frontend.zip