Combine release workflow into CI
This commit is contained in:
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
@@ -285,7 +285,7 @@ jobs:
|
|||||||
# Release image if tests pass
|
# Release image if tests pass
|
||||||
# Don't run this for pull requests
|
# Don't run this for pull requests
|
||||||
#
|
#
|
||||||
release:
|
publish-images:
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
needs: [test, build-amd64, build-arm64, build-armv7, style, build-client]
|
needs: [test, build-amd64, build-arm64, build-armv7, style, build-client]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -344,3 +344,54 @@ jobs:
|
|||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-arm64
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-arm64
|
||||||
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-armv7
|
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-armv7
|
||||||
|
#
|
||||||
|
# Create Github Release if CI was triggered by a tag
|
||||||
|
#
|
||||||
|
publish-release:
|
||||||
|
if: ${{ github.event_name != 'pull_request' }} && startsWith(github.event.ref, 'refs/tags/v')
|
||||||
|
needs: [publish-images]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Assert ref_name
|
||||||
|
run: |
|
||||||
|
echo "ref_name: ${{ github.ref_name }}"
|
||||||
|
if [ "${{ github.ref_name }}" != "v*" ]; then
|
||||||
|
echo "This job should only run on tags"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Download built spoolman
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: spoolman
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Extract spoolman
|
||||||
|
run: |
|
||||||
|
unzip /tmp/spoolman.zip -d /tmp/spoolman
|
||||||
|
rm /tmp/spoolman.zip
|
||||||
|
|
||||||
|
- name: Generate release info
|
||||||
|
run: |
|
||||||
|
cd /tmp/spoolman
|
||||||
|
echo '{
|
||||||
|
"project_name": "Spoolman",
|
||||||
|
"project_owner": "Donkie",
|
||||||
|
"version": "${{ github.ref_name }}"
|
||||||
|
}' > release_info.json
|
||||||
|
|
||||||
|
- name: Zip
|
||||||
|
run: |
|
||||||
|
cd /tmp/spoolman
|
||||||
|
zip -r spoolman.zip *
|
||||||
|
|
||||||
|
- name: Create release and upload build
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
id: create-release
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
name: ${{ github.ref_name }}
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
files: /tmp/spoolman/spoolman.zip
|
||||||
|
body: "⚠️ TODO ⚠️"
|
||||||
|
|
||||||
|
|||||||
59
.github/workflows/release.yml
vendored
59
.github/workflows/release.yml
vendored
@@ -1,59 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
package:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
cd client
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd client
|
|
||||||
rm -f .env && echo "VITE_APIURL=/api/v1" > .env.production
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
- name: Generate release info
|
|
||||||
run: |
|
|
||||||
echo '{
|
|
||||||
"project_name": "Spoolman",
|
|
||||||
"project_owner": "Donkie",
|
|
||||||
"version": "${{ github.ref_name }}"
|
|
||||||
}' > release_info.json
|
|
||||||
|
|
||||||
# Remove client source and keep only the built dist
|
|
||||||
- name: Clean
|
|
||||||
run: |
|
|
||||||
mv client/dist dist
|
|
||||||
rm -rf client
|
|
||||||
mkdir client
|
|
||||||
mv dist client/dist
|
|
||||||
|
|
||||||
- name: Zip
|
|
||||||
run: |
|
|
||||||
zip -r spoolman.zip *
|
|
||||||
|
|
||||||
- name: Create release and upload build
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
id: create-release
|
|
||||||
with:
|
|
||||||
draft: true
|
|
||||||
name: ${{ github.ref_name }}
|
|
||||||
tag_name: ${{ github.ref_name }}
|
|
||||||
files: ./spoolman.zip
|
|
||||||
body: "⚠️ TODO ⚠️"
|
|
||||||
Reference in New Issue
Block a user