-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from Opetushallitus/OY-4937
Oy 4937
- Loading branch information
Showing
3 changed files
with
138 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: Tarjonta-service | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
test-and-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache local Maven repository | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'corretto' | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 8.12.0 | ||
|
||
- uses: szenius/set-timezone@v1.0 | ||
with: | ||
timezoneLinux: "Europe/Helsinki" | ||
|
||
- name: Build with Maven | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
node -v | ||
npm -v | ||
mvn clean package -B -Dbranch=${GITHUB_REF_NAME} -Drevision=${GITHUB_SHA} -DbuildNumber=${GITHUB_RUN_NUMBER} | ||
node -v | ||
npm -v | ||
- uses: actions/cache@v4 | ||
id: restore-build | ||
with: | ||
path: | | ||
target | ||
tarjonta-api/target | ||
tarjonta-app/target | ||
tarjonta-app-angular/target | ||
tarjonta-service/target | ||
tarjonta-shared/target | ||
key: ${{ github.sha }} | ||
|
||
deploy-container: | ||
needs: test-and-build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
id: restore-build | ||
with: | ||
path: | | ||
target | ||
tarjonta-api/target | ||
tarjonta-app/target | ||
tarjonta-app-angular/target | ||
tarjonta-service/target | ||
tarjonta-shared/target | ||
key: ${{ github.sha }} | ||
|
||
- name: Build and deploy Docker container | ||
shell: bash | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
git clone https://github.com/Opetushallitus/ci-tools.git | ||
source ci-tools/common/setup-tools.sh | ||
export ARTIFACT_NAME="tarjonta" | ||
export TZ=Europe/Helsinki | ||
mv tarjonta-service/target/tarjonta-service.war $DOCKER_BUILD_DIR/artifact/tarjonta-service.war | ||
mv tarjonta-app/target/tarjonta-app-*.war $DOCKER_BUILD_DIR/artifact/tarjonta-app.war | ||
cp -vr src/main/resources/oph-configuration $DOCKER_BUILD_DIR/config/ | ||
export BASE_IMAGE="baseimage-war-openjdk8:master" | ||
./ci-tools/common/pull-image.sh | ||
./ci-tools/github-build/build-war.sh $ARTIFACT_NAME | ||
./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME | ||
deploy-jar-library: | ||
needs: test-and-build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
id: restore-build | ||
with: | ||
path: | | ||
target | ||
tarjonta-api/target | ||
tarjonta-app/target | ||
tarjonta-app-angular/target | ||
tarjonta-service/target | ||
tarjonta-shared/target | ||
key: ${{ github.sha }} | ||
|
||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'corretto' | ||
|
||
- name: Deploy jar library | ||
if: github.ref == 'refs/heads/master' | ||
shell: bash | ||
env: | ||
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
run: | | ||
git clone https://github.com/Opetushallitus/ci-tools.git | ||
source ci-tools/common/setup-tools.sh | ||
mvn deploy -pl tarjonta-api,tarjonta-shared -DskipTests --settings ci-tools/common/maven-settings.xml |
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
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