mirror of
https://github.com/barkeser2002/mcsleepingserverstarter.git
synced 2026-09-25 07:50:08 +03:00
94 lines
2.8 KiB
YAML
94 lines
2.8 KiB
YAML
# https://github.com/actions/create-release
|
|
# https://github.com/actions/upload-release-asset
|
|
|
|
name: Create release
|
|
|
|
on:
|
|
push:
|
|
# Sequence of patterns matched against refs/tags
|
|
tags:
|
|
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [22.x]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- run: npm ci
|
|
- run: npm run build --if-present
|
|
- run: npm run test --if-present
|
|
- name: Save executables
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: ./bin
|
|
retention-days: 1
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Retrieve saved executables
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: ./bin
|
|
- run: |
|
|
tag_name="${GITHUB_REF##*/}"
|
|
gh release create "$tag_name" ./bin/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build_docker:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Retrieve saved executables
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: ./bin
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
- name: Set up QEMU (to support building for both amd64 and arm64)
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
- run: |
|
|
mkdir ./docker/mcsleepingserverstarter-linux
|
|
cp ./bin/mcsleepingserverstarter-linux-x64 ./docker/mcsleepingserverstarter-linux/amd64
|
|
cp ./bin/mcsleepingserverstarter-linux-arm64 ./docker/mcsleepingserverstarter-linux/arm64
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
push: true
|
|
context: ./docker
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|