Merge pull request #1994 from kwoot/add-artifact-id-to-action
Now also uploads artifact with git hash in name.
This commit is contained in:
commit
cc9800365d
1 changed files with 31 additions and 10 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
|
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||||
# The first Forgejo action of this project.
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||||
# This builds the main branch on jdk8.
|
|
||||||
|
|
||||||
name: Ubuntu 24.04 (Noble Numbat)
|
name: Ubuntu 24.04 (Noble Numbat)
|
||||||
|
|
||||||
|
|
@ -10,6 +9,11 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
# Prevent cancellation of already running actions when pushing concurrently. Test
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
|
|
@ -33,12 +37,19 @@ jobs:
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
# Define job-id
|
||||||
|
- name: actions prep
|
||||||
|
id: artifact-upload-prep
|
||||||
|
run: echo ::set-output name=artifact-id::$(git rev-parse --short=10 HEAD)
|
||||||
|
|
||||||
- name: install needed software
|
- name: install needed software
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y postgresql-client nodejs git maven libpostgresql-jdbc-java
|
apt-get install -y postgresql-client nodejs git maven libpostgresql-jdbc-java
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Let's test caching maven stuff.
|
# Let's test caching maven stuff.
|
||||||
- name: Cache Maven repository
|
- name: Cache Maven repository
|
||||||
|
|
@ -48,7 +59,7 @@ jobs:
|
||||||
key: maven-${{ hashFiles('**/pom.xml') }}
|
key: maven-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: maven-
|
restore-keys: maven-
|
||||||
|
|
||||||
# Create extra database
|
# Example 1: create extra database
|
||||||
- name: Create libreplandevtest database
|
- name: Create libreplandevtest database
|
||||||
env:
|
env:
|
||||||
PGPASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
PGPASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
@ -78,15 +89,25 @@ jobs:
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Yes, this looks ugly. But when cleanup over several lines mvn
|
||||||
|
# starts complaining: The POM for -DdataSource.url=jdbc:postgresql:jar://postgres is missing
|
||||||
|
# Starts thinking the datasource url is a pom it should download. Weird.
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn clean install --no-transfer-progress -Ddefault.passwordsControl=false -Ddefault.exampleUsersDisabled=false -DdataSource.url=jdbc:postgresql://postgres:5432/libreplandev -DdataSource.user=libreplan -DdataSource.password=libreplan -DjdbcDriver.className=org.postgresql.Driver
|
shell: bash
|
||||||
|
run: mvn clean install --no-transfer-progress -Ddefault.passwordsControl=false -Ddefault.exampleUsersDisabled=false -DdataSource.url=jdbc:postgresql://postgres:5432/libreplandev -DdataSource.user=libreplan -DdataSource.password=libreplan -DjdbcDriver.className=org.postgresql.Driver
|
||||||
|
|
||||||
# Are we brave enough to upload the result?
|
# Upload the result
|
||||||
- uses: actions/upload-artifact@v3
|
- name: Upload libreplan.war attempt 1
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: libreplan.war
|
name: libreplan.war
|
||||||
path: libreplan-webapp/target/libreplan-webapp.war
|
path: libreplan-webapp/target/libreplan-webapp.war
|
||||||
retention-days: 3
|
retention-days: 3
|
||||||
|
|
||||||
- name: Output artifact ID
|
- name: Upload libreplan.war with git hash
|
||||||
run: echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: libreplan-${{ steps.artifact-upload-prep.outputs.artifact-id }}.war
|
||||||
|
path: libreplan-webapp/target/libreplan-webapp.war
|
||||||
|
retention-days: 3
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue