run package on failure #16
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: CI build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
tarFile: "output-${{ github.job }}-${{ github.run_number }}-${{ github.run_attempt }}.tar.gz" | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
id: setup_build_jdk | |
name: Setup Build JDK | |
with: | |
java-version: 21 | |
distribution: temurin | |
cache: maven | |
- name: Build | |
run: | | |
./mvnw clean install | |
- name: Package | |
if: failure() | |
run: | | |
FOLDER=$(basename `pwd`) | |
cd .. | |
tar czf ${{ runner.temp }}/${{ env.tarFile }} --exclude=.git $FOLDER | |
mv ${{ runner.temp }}/${{ env.tarFile }} ${{ github.workspace }} | |
- uses: keithweaver/[email protected] | |
name: Upload | |
if: failure() | |
with: | |
command: cp | |
source: ${{ github.workspace }}/${{ env.tarFile }} | |
destination: s3://github-action-error-logs/${{ github.repository }}/${{ env.tarFile }} | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws_region: us-east-1 |