Skip to content

Commit

Permalink
Fix/ci (#126)
Browse files Browse the repository at this point in the history
updated staging CI
  • Loading branch information
dorian-grst committed Jun 14, 2024
1 parent 76dbeb3 commit d22745c
Showing 1 changed file with 46 additions and 16 deletions.
62 changes: 46 additions & 16 deletions .github/workflows/build-staging.yml
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: |
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d22745c

Please sign in to comment.