-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup GH release, update docker image, use depot in CI
- Loading branch information
Showing
5 changed files
with
131 additions
and
26 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# release package | ||
name: Github Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build-binaries: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
strategy: | ||
matrix: | ||
arch: [x64,arm64] | ||
platform: [linux,macos,win] | ||
exclude: | ||
- platform: win # need to debug it | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: depot/setup-action@v1 | ||
with: | ||
oidc: true | ||
- name: Build using Docker (with depot) | ||
run: depot build --project ${{ vars.DEPOT_PROJECT_ID }} --build-arg CLI_TARGET=${{ matrix.platform }}-${{ matrix.arch }} -f Dockerfile.cli --target=cli --output=type=local,dest=./preevy-bin --progress=plain --platform=linux/${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }} . | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: preevy-bin | ||
path: ./preevy-bin/** | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build-binaries | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: depot/setup-action@v1 | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: preevy-bin | ||
path: ./preevy-bin | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true | ||
draft: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
files: | | ||
./preevy-bin/** |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
FROM node:18-bullseye as builder | ||
FROM node:18-bullseye as base | ||
FROM base as deps-files | ||
WORKDIR /app | ||
COPY --link yarn.lock package.json . | ||
COPY --link packages packages | ||
RUN find . -type f -not -iname "yarn.lock" -not -iname "package.json" -delete && find . -type l -delete && find . -type d -empty -delete | ||
|
||
FROM alpine as ldid | ||
RUN wget -q https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus7/ldid_linux_aarch64 -O /usr/bin/ldid | ||
RUN chmod +x /usr/bin/ldid | ||
|
||
FROM base as builder | ||
WORKDIR /app | ||
COPY --link . /app/ | ||
COPY --link --from=deps-files /app /app | ||
RUN --mount=type=cache,id=livecycle/preevy-cli/yarn-cache,target=/yarn/cache \ | ||
yarn --cache-folder=/yarn/cache | ||
|
||
RUN yarn clean && yarn build | ||
COPY --link . . | ||
RUN yarn build | ||
|
||
FROM builder as pkg | ||
ARG CLI_TARGET=macos-arm64 | ||
WORKDIR /app/packages/cli | ||
ENV PKG_CACHE_PATH=/pkg/cache | ||
COPY --from=ldid --link /usr/bin/ldid /usr/bin/ldid | ||
RUN --mount=type=cache,id=livecycle/preevy-cli/pkg-cache,target=/pkg/cache \ | ||
yarn pkg --public --public-packages tslib --options max_old_space_size=4096 -t node18-alpine-arm64 . | ||
yarn pkg --compress GZip --no-dict --public --public-packages tslib --options max_old_space_size=4096 -t node18-${CLI_TARGET} . | ||
|
||
FROM scratch as cli | ||
ARG CLI_TARGET=macos-arm64 | ||
COPY --link --from=pkg /app/packages/cli/preevy /preevy-${CLI_TARGET} | ||
# use docker buildx build -f Dockerfile.cli --target=cli . --output=type=local,dest=./dist | ||
|
||
# FROM docker:24-cli | ||
# COPY --from=pkg /app/packages/cli/preevy /usr/bin/ | ||
# CMD [ "preevy" ] | ||
FROM docker:24-cli as release | ||
COPY --from=pkg /app/packages/cli/preevy /usr/bin/ | ||
CMD [ "preevy" ] |
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
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