Skip to content

feat: show & move pieces #69

feat: show & move pieces

feat: show & move pieces #69

Workflow file for this run

name: Publish and deploy server
on:
push:
branches:
- main
release:
types: [created]
workflow_dispatch:
jobs:
push_to_registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v1
- 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-central-1
- name: Cache cargo deps
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Test Rust crates
uses: actions-rs/cargo@v1
with:
command: test
# cargo fmt --all -- --check # For linting
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: ./
file: ./crates/server/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
load: true
tags: latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build docker image and push it to Docker registry
run: |
VERSION=$(cat crates/server/Cargo.toml | grep version | awk -F'[ "]' 'NR==1{print $4}') \
./ex.sh docker:push
env:
AWS_ACCOUNT_ID: 626386600593
AWS_REGION: eu-central-1
ECR_REPOSITORY: tic-tac-5
IMAGE_PATH: ./crates/server/Dockerfile
deploy:
needs: push_to_registry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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-central-1
- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: .ansible/deploy-server/playbook.yml
key: ${{ secrets.HETZNER_SSH_PRIVATE_KEY }}
inventory: |
[tic-tac-5]
95.217.183.51
[all:vars]
ansible_ssh_user=root
options: |
--verbose