Refator sign order from view to login-aware query #24
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Auslan Signbank | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
# test: | |
# services: | |
# postgres: | |
# image: postgres:12 | |
# ports: ["5432:5432"] | |
# env: | |
# POSTGRES_PASSWORD: postgres | |
# options: >- | |
# --health-cmd pg_isready | |
# --health-interval 10s | |
# --health-timeout 5s | |
# --health-retries 5 | |
# name: Test | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Set up Elixir | |
# uses: erlef/setup-beam@v1 | |
# with: | |
# version-type: strict | |
# version-file: .tool-versions | |
# - name: Restore dependencies cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: deps | |
# key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
# restore-keys: ${{ runner.os }}-mix- | |
# - name: Install dependencies | |
# run: mix deps.get | |
# - name: Compiles without warnings | |
# run: mix compile | |
# env: | |
# MIX_ENV: test | |
# - name: Check formatting | |
# run: mix format --check-formatted | |
# env: | |
# MIX_ENV: test | |
# - name: Run tests | |
# run: mix test | |
# env: | |
# MIX_ENV: test | |
# DATABASE_HOST: localhost | |
# DATABASE_USER: postgres | |
# DATABASE_PASS: postgres | |
build: | |
name: Build release | |
runs-on: ubuntu-latest | |
outputs: | |
artifact_name: ${{ steps.output.outputs.artifact_name }} | |
artifact_filename: ${{ steps.output.outputs.artifact_filename }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Set release version | |
run: | | |
echo "VERSION=$(grep 'version:' mix.exs | cut -d '"' -f2)" >> $GITHUB_ENV | |
- name: Release v${{ env.VERSION }} | |
run: | | |
mix compile | |
mix assets.deploy | |
mix release | |
env: | |
MIX_ENV: prod | |
- name: Set job output | |
id: output | |
run: | | |
echo "artifact_name=signbank-${{ env.VERSION }}" >> "$GITHUB_OUTPUT" | |
echo "artifact_filename=signbank-${{ env.VERSION }}.tar.gz" >> "$GITHUB_OUTPUT" | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: signbank-${{ env.VERSION }} | |
path: _build/prod/signbank-${{ env.VERSION }}.tar.gz | |
deploy: | |
name: Deploy release | |
runs-on: ubuntu-latest | |
environment: | |
name: uat | |
url: https://uat.auslan.org.au | |
needs: build | |
steps: | |
- name: Download a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{ needs.build.outputs.artifact_name }} | |
- name: Copy, untar and run release | |
# You may pin to the exact commit or the version. | |
# uses: cross-the-world/ssh-scp-ssh-pipelines@78e864b4890087a58248ff39320406971ca88b89 | |
uses: cross-the-world/[email protected] | |
with: | |
host: ${{ vars.STAGING_REMOTE_HOST }} | |
port: 22 | |
user: ${{ vars.STAGING_REMOTE_USER }} | |
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }} | |
first_ssh: mkdir -p ${{ vars.STAGING_REMOTE_TARGET }}/signbank | |
# scp from local to remote | |
scp: | | |
'${{ needs.build.outputs.artifact_filename }}' => "${{ vars.STAGING_REMOTE_TARGET }}/signbank" | |
last_ssh: | | |
tar -xzf signbank/${{ needs.build.outputs.artifact_filename }} --directory /opt/signbank | |
sudo mv /opt/signbank/*.service /etc/systemd/system --force | |
sudo systemctl daemon-reload | |
echo "Restarting existing application..." | |
sudo systemctl restart signbank | |
echo "Deleting release tarball..." | |
rm ${{ vars.STAGING_REMOTE_TARGET }}/signbank/${{ needs.build.outputs.artifact_filename }} |