zdravko/.github/workflows/build.yaml

70 lines
1.7 KiB
YAML
Raw Normal View History

2024-02-16 21:31:00 +00:00
name: Build
on:
push:
branches:
- "main"
2024-02-16 21:31:00 +00:00
pull_request:
jobs:
build:
runs-on: ubuntu-latest
2024-06-06 19:37:41 +00:00
permissions:
contents: read
packages: write
attestations: write
id-token: write
2024-02-16 21:31:00 +00:00
steps:
- name: Checkout
2024-06-06 19:37:41 +00:00
uses: actions/checkout@v4
with:
fetch-depth: 0
2024-02-16 21:31:00 +00:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
2024-06-06 19:41:00 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2024-02-16 21:31:00 +00:00
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
2024-06-06 19:37:41 +00:00
username: ${{ github.actor }}
2024-02-16 21:31:00 +00:00
password: ${{ secrets.GITHUB_TOKEN }}
2024-06-06 19:37:41 +00:00
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
2024-02-16 21:31:00 +00:00
with:
2024-06-06 19:37:41 +00:00
enable-cache: true
2024-06-03 19:34:39 +00:00
- name: Setup Golang cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2024-06-06 19:37:41 +00:00
- name: Build artifacts
run: devbox run -- just unstable
2024-06-02 19:55:52 +00:00
2024-06-06 19:37:41 +00:00
- uses: actions/upload-artifact@v4
2024-02-16 21:31:00 +00:00
with:
2024-06-06 19:37:41 +00:00
name: Unstable Build
path: dist
2024-02-18 09:38:14 +00:00
deploy:
runs-on: ubuntu-latest
2024-02-18 09:49:28 +00:00
needs: build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
2024-02-18 09:38:14 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install devbox
2024-06-03 21:38:46 +00:00
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: true
2024-02-18 09:38:14 +00:00
2024-02-19 10:09:31 +00:00
- run: devbox run -- just deploy-fly
2024-02-18 09:38:14 +00:00
if : github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}