Merge pull request #276 from subclipse/dependabot/github_actions/acti… #141
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: Subclipse Build | |
on: | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
ARTIFACT_PATHNAME=$(ls ./releng/update-site/target/*.zip | head -n 1) | |
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME .zip) | |
echo ARTIFACT_PATHNAME=$ARTIFACT_PATHNAME >> $GITHUB_ENV | |
echo ARTIFACT_NAME=$ARTIFACT_NAME >> $GITHUB_ENV | |
- name: Archive Update Site | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ env.ARTIFACT_PATHNAME }} | |
- name: Publish Build | |
if: github.event_name == 'push' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.SUBCLIPSE_TOKEN }} | |
repository-name: subclipse/snapshots | |
branch: main | |
folder: ./releng/update-site/target/repository | |
target-folder: subclipse | |
clean: false | |
single-commit: false | |
- name: Publish Release | |
if: github.event_name == 'release' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.SUBCLIPSE_TOKEN }} | |
repository-name: subclipse/updates | |
branch: main | |
folder: ./releng/update-site/target/repository | |
target-folder: subclipse/${{ github.event.release.tag_name }} | |
clean: false | |
single-commit: false | |
- name: Attach Zipped Site to Release | |
uses: actions/upload-release-asset@v1 | |
if: github.event_name == 'release' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ env.ARTIFACT_PATHNAME }} | |
asset_name: subclipse-${{ github.event.release.tag_name }}.zip | |
asset_content_type: application/zip |