try ci artifacts

This commit is contained in:
Aine 2024-09-03 15:40:23 +03:00
parent 3c6259cc88
commit c8246a1d19
No known key found for this signature in database
GPG key ID: 34969C908CCA2804

View file

@ -6,56 +6,84 @@ env:
upstream_version: v0.10.3
etke_version: etke6
bunny_version: v0.1.0
base_path: ./
permissions:
checks: write
contents: write
packages: write
pull-requests: read
jobs:
build-publish:
name: Build and Publish
runs-on: self-hosted
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v3
- uses: actions/setup-node@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
node-version: lts
cache: yarn
- name: Install dependencies
run: yarn install --immutable --network-timeout=300000
- name: Build
run: yarn build --base=${{ env.base_path }}
- uses: actions/upload-artifact@v4
with:
images: |
ghcr.io/${{ github.repository }}
registry.etke.cc/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=raw,value=${{ env.upstream_version }}-${{ env.etke_version }},enable=${{ github.ref_name == 'main' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-deploy:
name: Build and Release
needs: build-publish
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository }} # as this job depends on the build-publish and build-publish always publishes the latest tag
path: dist/
name: dist-${{ env.upstream_version }}-${{ env.etke_version }}
if-no-files-found: error
retention-days: 1
compression-level: 0
overwrite: true
include-hidden-files: true
docker:
name: Docker
needs: build
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Upload
run: |
wget -O bunny-upload.tar.gz https://github.com/etkecc/bunny-upload/releases/download/${{ env.bunny_version }}/bunny-upload_Linux_x86_64.tar.gz
tar -xzf bunny-upload.tar.gz
echo "${{ secrets.BUNNY_CONFIG }}" > bunny-config.yaml
./bunny-upload -c bunny-config.yaml
- uses: actions/download-artifact@v4
with:
name: dist-${{ env.upstream_version }}-${{ env.etke_version }}
- name: Debug
run: ls -lah
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Login to ghcr.io
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# ghcr.io/${{ github.repository }}
# registry.etke.cc/${{ github.repository }}
# tags: |
# type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
# type=raw,value=${{ env.upstream_version }}-${{ env.etke_version }},enable=${{ github.ref_name == 'main' }}
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# platforms: linux/amd64,linux/arm64
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# build-deploy:
# name: Build and Release
# needs: build-publish
# runs-on: ubuntu-latest
# container: ghcr.io/${{ github.repository }} # as this job depends on the build-publish and build-publish always publishes the latest tag
# steps:
# - uses: actions/checkout@v4
# - name: Upload
# run: |
# wget -O bunny-upload.tar.gz https://github.com/etkecc/bunny-upload/releases/download/${{ env.bunny_version }}/bunny-upload_Linux_x86_64.tar.gz
# tar -xzf bunny-upload.tar.gz
# echo "${{ secrets.BUNNY_CONFIG }}" > bunny-config.yaml
# ./bunny-upload -c bunny-config.yaml