Update the BUILD.YAML file #43
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
name: OnilineBookStore CI | |
on: [push] | |
jobs: | |
build-project: | |
name: Build Project | |
runs-on: ubuntu-latest | |
env: | |
ACTIONS_STEP_DEBUG: true | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- run: mvn clean package | |
- run: mkdir staging && cp target/onlinebookstore.war staging | |
- name: Run tests and generate code coverage report | |
run: mvn testCoverage | |
- name: upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: onlinebookstore | |
path: staging | |
release-project: | |
name: Release Project | |
runs-on: ubuntu-latest | |
needs: build-project | |
steps: | |
- name: download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: onlinebookstore | |
path: staging | |
- name: Test the arifacts | |
run: ls -R | |
- name: archieve artifacts | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: 'onlinebookstore.zip' | |
- name: Create a release | |
id: create-new-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.run_number}} | |
release_name: Release ${{ github.run_number }} | |
- name: Upload Release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-new-release.outputs.upload_url }} | |
asset_path: onlinebookstore.zip | |
asset_name: onlinebookstore-v${{ github.run_number }}.zip | |
asset_content_type: application/zip | |