update: packages #53
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: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*.*.*" | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip-ci]')" | |
env: | |
LOG_LEVEL: "info" | |
LOGTAIL_TOKEN: "${{ secrets.LOGTAIL_TOKEN }}" | |
LOGTAIL_TOKEN_DOCKER: "${{ secrets.LOGTAIL_TOKEN_DOCKER }}" | |
NODE_ENV: "production" | |
REGISTRY: "ghcr.io" | |
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" | |
SENTRY_DSN: "${{ secrets.SENTRY_DSN }}" | |
SENTRY_ORG: "${{ secrets.SENTRY_ORG }}" | |
SENTRY_PROJECT: "${{ secrets.SENTRY_PROJECT }}" | |
TEST_TAG: "${{ github.repository }}:test-${{ github.sha }}" | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
platforms: linux/amd64 | |
tags: ${{ env.TEST_TAG }} | |
- run: docker run --detach --env PORT_SERVER=8081 --env LOGTAIL_TOKEN_DOCKER=${{ env.LOGTAIL_TOKEN_DOCKER }} --interactive --rm --tty ${{ env.TEST_TAG }} | xargs echo stdout= | tr -d '[:space:]' >> $GITHUB_OUTPUT | |
id: docker-run | |
- run: sleep 15s | |
shell: bash | |
- run: docker stop ${{ steps.docker-run.outputs.stdout }} | |
- run: docker rmi ${{ env.TEST_TAG }} | |
- uses: docker/build-push-action@v4 | |
with: | |
context: . | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: | | |
linux/amd64 | |
# linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
- uses: ruby/setup-ruby@v1 | |
if: github.ref_type == 'tag' | |
with: | |
bundler-cache: true | |
ruby-version: "3.2" | |
- run: kamal deploy --skip-push --version ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
if: github.ref_type == 'tag' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |