Skip to content

PVQ-4362 External actions - If an external action fails, log the erro… #45

PVQ-4362 External actions - If an external action fails, log the erro…

PVQ-4362 External actions - If an external action fails, log the erro… #45

Workflow file for this run

name: Maven Release
on:
push:
tags:
- 'v*.*.*' # Matches version tags like v1.0.0
env:
ACTION_NAMESPACE: pdfix
ACTION_REPOSITORY: validate-pdf-pdfix
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/*.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set env variables
run: echo "tag=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Download and unzip SDK JAR file
run: |
mkdir -p lib
curl -L https://github.com/pdfix/pdfix_sdk_builds/releases/download/v8.7.3/java-net.pdfix.pdfixlib-8.7.3_b2f5cb96.jar.zip -o lib/pdfixlib-8.7.3.jar.zip
unzip lib/pdfixlib-8.7.3.jar.zip -d lib/
rm lib/pdfixlib-8.7.3.jar.zip
mvn install:install-file -Dfile=lib/net.pdfix.pdfixlib-8.7.3.jar -DgroupId=net.pdfix -DartifactId=net.pdfix.pdfixlib -Dversion=8.7.3 -Dpackaging=jar
- name: Update config.json version
run: chmod +x update_version.sh && ./update_version.sh ${{ env.tag }}
- name: Build with Maven
run: |
mvn compile
mvn test
mvn package
# run: mvn clean install -DskipTests
- name: Run tests
run: chmod +x test.sh && ./test.sh
- name: Prepare files for release
id: prepare-for-release
run: |
RELEASE_DIR=net.pdfix.validate-pdf-${{ env.tag }}
echo "release_dir=$RELEASE_DIR" >> $GITHUB_OUTPUT
mkdir ${RELEASE_DIR}
cp target/net.pdfix.*.jar ${RELEASE_DIR}/
cp config.json ${RELEASE_DIR}/
- name: Zip the release files
run: |
RELEASE_DIR=${{ steps.prepare-for-release.outputs.release_dir }}
zip -r "net.pdfix.validate-pdf-${{ env.tag }}.zip" $RELEASE_DIR/
# - name: Publish Release
# run: mvn deploy -P release -DskipTests
# env:
# MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
# MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
net.pdfix.validate-pdf-${{ env.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to FTP
run: |
curl -T config.json ftp.pdfix.net/update-service/v1/actions/${{ env.ACTION_NAMESPACE }}/${{ env.ACTION_REPOSITORY }}/config.json --user "${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }}" --ftp-create-dirs
- name: Prepare directory for versions repository
run: mkdir -p pdfix-version-updates
- name: Checkout versions repository
uses: actions/checkout@v4
with:
repository: pdfix/pdfix-version-updates
path: pdfix-version-updates
token: ${{ secrets.PAT_VERSIONS }}
ref: main
fetch-depth: 0
- name: Update versions repository with new version
run: chmod +x update_versions_repository.sh && ./update_versions_repository.sh ${{ env.ACTION_NAMESPACE }} ${{ env.ACTION_REPOSITORY }} ${{ env.tag }}