Skip to content

Deploy to CDN

Deploy to CDN #5

Workflow file for this run

name: Deploy to CDN
on:
workflow_dispatch:
jobs:
upload:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Publish maven artifacts
run: ./gradlew publish
- name: Build gui
run: ./gradlew :gui:build
- name: Deploy to S3
run: ./gradlew uploadJarsToS3
- name: Generate bootstrap signature
run: 'echo "$SIGNING_PRIVATE_KEY" > private.pem && openssl dgst -sha256 -sign private.pem -out bootstrap.json.sha256 bootstrap.json'
env:
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
- name: Upload bootstrap
run: |
aws s3 cp bootstrap.json s3://cdn.rsprox.net/launcher/
aws s3 cp bootstrap.json.sha256 s3://cdn.rsprox.net/launcher/
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/launcher/*" "/dependencies/*" "/maven/*"
env:
CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}