metacubexd/.github/workflows/release.yml
2023-08-30 00:40:47 +08:00

101 lines
2.4 KiB
YAML

name: release
on:
push:
branches: main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
release-assets:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: latest
- name: install dependencies
run: pnpm install
- name: build for gh-pages
run: pnpm build --base /metacubexd
- name: publish gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
- name: build for github release
run: pnpm build
- name: zip
run: |
zip -r ../dist.zip .
working-directory: dist
- name: attach github release artifacts
uses: softprops/action-gh-release@v1
with:
files: dist.zip
tag_name: ${{ needs.release-please.outputs.tag_name }}
release-image:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- name: set up QEMU
uses: docker/setup-qemu-action@v2
- name: set up docker buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: login to ghrc.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and publish ghcr.io docker image
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max