Skip to content

feat: improve line selection highlighting (#34) #21

feat: improve line selection highlighting (#34)

feat: improve line selection highlighting (#34) #21

Workflow file for this run

name: Build and deploy
on:
push:
tags: [ 'v*.*' ]
env:
REGISTRY: ghcr.io
PLATFORMS: linux/amd64,linux/arm64
jobs:
frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
IMAGE_NAME: ${{ github.repository }}-${{ github.job }}
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: ${{ github.job }}/
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
server:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
IMAGE_NAME: ${{ github.repository }}-${{ github.job }}
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: ${{ github.job }}/
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
deploy:
runs-on: ubuntu-latest
needs: [frontend, server]
steps:
- name: Executing remote ssh commands
id: ssh
uses: appleboy/[email protected]
with:
host: ${{ secrets.OCI_HOST }}
username: ${{ secrets.OCI_USERNAME }}
key: ${{ secrets.OCI_KEY }}
command_timeout: 30m
script: cd ${{ github.event.repository.name }} && sudo ./deploy.sh
notify-success:
runs-on: ubuntu-latest
needs: [deploy]
steps:
- name: Get metadata
id: meta
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Success notification to discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_ROLE_ID: ${{ secrets.DISCORD_ROLE_ID }}
uses: Ilshidur/[email protected]
with:
args: |
<@&{{ DISCORD_ROLE_ID }}>
✅ [{{GITHUB_REPOSITORY}}](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}>)@[${{ steps.meta.outputs.VERSION }}](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}/releases/tag/${{ steps.meta.outputs.VERSION }}>) has been deployed successfully.
🧾 [Click to see detail](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}/actions/runs/{{GITHUB_RUN_ID}}>)
notify-fail:
runs-on: ubuntu-latest
needs: [frontend, server, deploy]
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- name: Get metadata
id: meta
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Failure notification to discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_ROLE_ID: ${{ secrets.DISCORD_ROLE_ID }}
uses: Ilshidur/[email protected]
with:
args: |
<@&{{ DISCORD_ROLE_ID }}>
❌ Deployment of [{{GITHUB_REPOSITORY}}](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}>)@[${{ steps.meta.outputs.VERSION }}](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}/releases/tag/${{ steps.meta.outputs.VERSION }}>) has failed.
🧾 [Click to see detail](<{{GITHUB_SERVER_URL}}/{{GITHUB_REPOSITORY}}/actions/runs/{{GITHUB_RUN_ID}}>)