Try to fix dir renaming on S3 #1769
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 | |
on: | |
# allow manual dispatch | |
workflow_dispatch: | |
# run on pushes to master | |
push: | |
branches: | |
- master | |
- staging | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
REGISTRY: ghcr.io | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Get timestamp | |
id: timestamp | |
run: echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: 'maven' | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Cache pnpm | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Build backend | |
working-directory: backend | |
run: mvn --batch-mode --errors --fail-at-end --show-version --no-transfer-progress install | |
- name: Install frontend deps | |
run: (cd frontend && pnpm install --frozen-lockfile) | |
- name: Set environment for branch | |
run: | | |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then | |
echo "BACKEND_DATA_HOST=https://hangar.papermc.io" >> $GITHUB_ENV | |
else | |
echo "BACKEND_DATA_HOST=https://hangar.papermc.dev" >> $GITHUB_ENV | |
fi | |
- name: Lint frontend | |
env: | |
DEBUG: "hangar:*" | |
run: (cd frontend && pnpm prep && pnpm lint:eslint) | |
# - name: Sync forth and back with crowdin | |
# uses: crowdin/[email protected] | |
# with: | |
# upload_sources: true | |
# download_translations: true | |
# push_translations: false | |
# create_pull_request: false | |
# skip_untranslated_strings: true | |
# config: 'crowdin.yml' | |
# crowdin_branch_name: master | |
# env: | |
# CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
- name: Build frontend | |
env: | |
# keep these in sync with compose! | |
BACKEND_HOST: "http://hangar_backend:8080" | |
PUBLIC_HOST: "https://hangar.papermc.dev" | |
DEBUG: "hangar:*" | |
run: (cd frontend && pnpm build) | |
- name: Login to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker (frontend) | |
id: frontend-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}/frontend | |
tags: | | |
type=sha,enable=true,format=short,prefix=${{ env.BRANCH_NAME }}-,suffix=-${{ steps.timestamp.outputs.timestamp }} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push frontend Dockerfile | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: chart/dockerfiles/frontend/Dockerfile | |
tags: ${{ steps.frontend-meta.outputs.tags }} | |
labels: ${{ steps.frontend-meta.outputs.labels }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Extract metadata (tags, labels) for Docker (backend) | |
id: backend-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}/backend | |
tags: | | |
type=sha,enable=true,format=short,prefix=${{ env.BRANCH_NAME }}-,suffix=-${{ steps.timestamp.outputs.timestamp }} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push backend Dockerfile | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: chart/dockerfiles/backend/Dockerfile | |
tags: ${{ steps.backend-meta.outputs.tags }} | |
labels: ${{ steps.backend-meta.outputs.labels }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |