Latest #61
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: Deploy Main | |
on: | |
push: | |
branches: | |
- main | |
env: | |
RUMPEL: live | |
RUMPEL_ALT: latest | |
RUMPEL_BUCKET: dswift-hat-sandbox-frontend-build-artifacts | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Cache - GHA | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/coursier/v1/https | |
key: ${{ runner.OS }}-coursier-cache | |
- name: Cache - Resolvers | |
run: curl https://${{ secrets.ARTIFACTS_CACHE_BUCKET }}/resolvers.sbt --create-dirs -o ~/.sbt/resolvers.sbt | |
- name: Setup Java | |
uses: actions/[email protected] | |
with: | |
distribution: adopt | |
java-version: 11 | |
java-package: jdk | |
architecture: x64 | |
- name: App - Frontend | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER_SANDBOX_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER_SANDBOX_SECRET_ACCESS_KEY }} | |
run: | | |
cd ./hat/app/org/hatdex/hat/phata/assets/ | |
aws s3 cp s3://${{ env.RUMPEL_BUCKET }}/${{ env.RUMPEL }} rumpel --recursive --region eu-west-1 | |
aws s3 cp s3://${{ env.RUMPEL_BUCKET }}/${{ env.RUMPEL_ALT }} alt-rumpel --recursive --region eu-west-1 | |
cp rumpel/*.js* js/ | |
cp rumpel/*.css stylesheets/ | |
gzip --keep --force js/*.bundle.js | |
cp -r rumpel/assets/* . | |
cp -r alt-rumpel/* . | |
rm -r rumpel | |
rm -r alt-rumpel | |
cd - | |
- name: App - Build | |
run: sbt Docker/stage | |
- name: Container - Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Container - Setup Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Container - Login DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_DATASWIFT_USER }} | |
password: ${{ secrets.DOCKERHUB_DATASWIFT_PASS }} | |
- id: date | |
run: | | |
echo "::set-output name=ts::$(date +%s)" | |
- name: Container - Meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
dataswift/hat | |
tags: | | |
type=sha,prefix=main-,suffix=-${{ steps.date.outputs.ts }},format=short | |
- name: Container - Build & Push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: hat/target/docker/stage | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=registry,ref=ghcr.io/datasiwft/hat:latest | |
- name: Slack | |
uses: lazy-actions/slatify@master | |
if: failure() | |
with: | |
type: ${{ job.status }} | |
job_name: "*${{ env.GITHUB_WORKFLOW }}*" | |
channel: "ci" | |
commit: true | |
mention: "here" | |
mention_if: "failure" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
url: ${{ secrets.SLACK_WEBHOOK_URL }} |