-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,30 @@ | ||
name: Gigwa Build Staging | ||
name: Gigwa Build Staging test | ||
on: | ||
push: | ||
tags: | ||
- '*-STAGING' | ||
- 'STAGING' | ||
jobs: | ||
build: | ||
pre-realese: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Java | ||
uses: actions/[email protected] | ||
with: | ||
distribution: 'zulu' | ||
java-version: 17 | ||
|
||
- name: Run build script | ||
- name: Build project | ||
run: | | ||
wget https://raw.githubusercontent.com/${{ github.repository }}/staging/misc/build-staging.sh | ||
chmod +x build-staging.sh | ||
./build-staging.sh -P staging | ||
pwd | ||
ls | ||
- name: Upload Webapp Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ${{ github.event.repository.name }}/target/Gigwa_V*_Webapp.zip | ||
name: Gigwa_Webapp.zip | ||
if-no-files-found: error | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Delete release and tag | ||
- name: Delete old prelease and tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
|
@@ -42,7 +35,7 @@ jobs: | |
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME" \ | ||
| jq -r '.id') | ||
if [ "$RELEASE_ID" != "null" ]; then | ||
echo "Deleting release with ID $RELEASE_ID" | ||
# Delete the release | ||
|
@@ -57,6 +50,43 @@ jobs: | |
# Delete the tag from the remote repository | ||
git push origin :refs/tags/$TAG_NAME | ||
- name: Set up variables | ||
id: vars | ||
run: | | ||
echo "DATE=$(date +'%d/%m/%y')" >> $GITHUB_ENV | ||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
echo "NEW_NAME=Gigwa2_STAGING" >> $GITHUB_ENV | ||
- name: Create prerelease | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: "STAGING" | ||
release_name: "STAGING" | ||
draft: false | ||
prerelease: true | ||
body: "This is a staging prerelease ${{ env.DATE }} ${{ env.SHORT_SHA }}" | ||
|
||
- name: Grep release version | ||
id: grep_release_version | ||
run: | | ||
# RESULT=$(grep -m 1 project\\\.version ${{ github.event.repository.name }}/pom.xml | sed -n 's/.*<project\.version>\(.*\)<\/project\.version>.*/\1/p') | ||
echo "release_version=$(grep -m 1 project\\\.version ${{ github.event.repository.name }}/pom.xml | sed -n 's/.*<project\.version>\(.*\)<\/project\.version>.*/\1/p')" >>$GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Upload main prerelease asset (webapp zip) | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ github.event.repository.name }}/target/Gigwa_V${{ steps.grep_release_version.outputs.release_version }}_Webapp.zip | ||
asset_name: ${{ env.NEW_NAME }}.zip | ||
asset_content_type: application/zip | ||
|
||
# ssh: | ||
# runs-on: ubuntu-latest | ||
# needs: build | ||
|