Merge pull request #80 from guardian/update/non_aws #140
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: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
scala_steward: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
if: github.actor == 'gu-scala-steward-public-repos[bot]' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Check if PR has 'minor' or 'patch' label | |
id: check_labels | |
run: | | |
PR_URL="${{ github.event.pull_request.html_url }}" | |
PR_NUMBER=$(echo $PR_URL | awk -F/ '{print $NF}') | |
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name') | |
if [[ "$LABELS" != *"minor"* && "$LABELS" != *"patch"* ]]; then | |
echo "PR does not have 'minor' or 'patch' label. Skipping approval and merge." | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Approve a PR | |
if: steps.check_labels.outputs.result == 'success' | |
run: gh pr review --approve "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup JDK and sbt | |
uses: guardian/setup-scala@v1 | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | |
aws-region: eu-west-1 | |
- name: Build and Test | |
run: | | |
sbt compile test assembly | |
working-directory: ${{ github.workspace }} | |
- name: Copy jar to root | |
run: | | |
cp archive/target/scala-*/football-time-machine-archive.jar . | |
cp api/target/scala-*/football-time-machine-api.jar . | |
- uses: guardian/actions-riff-raff@v2 | |
with: | |
configPath: riff-raff.yaml | |
projectName: football-time-machine | |
buildNumberOffset: 90 | |
contentDirectories: | | |
football-time-machine-archive: | |
- football-time-machine-archive.jar | |
football-time-machine-api: | |
- football-time-machine-api.jar | |
football-time-machine: | |
- cfn.yaml |