Create build.yml

This commit is contained in:
liuzhihang 2022-11-14 23:00:01 +08:00 committed by GitHub
parent 6a1abc915d
commit d667d8a578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 0 deletions

41
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build distribution theme
on:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build distribution
run: |
pnpm build
- name: Compress zip
run: |
PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
PRE_ZIP_FOLDER=theme-anatole-${PACKAGE_VERSION}
ARTIFACT_NAME=${PRE_ZIP_FOLDER}.zip
ARTIFACT_PATHNAME=dist/${ARTIFACT_NAME}
echo "theme-anatole version $PACKAGE_VERSION"
echo "Artifact name: ${ARTIFACT_NAME}"
echo "Artifact pathname: ${ARTIFACT_PATHNAME}"
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
echo "RELEASE_ID=${{ github.event.release.id }}" >> $GITHUB_ENV
mkdir $PRE_ZIP_FOLDER
mkdir dist
cp -r theme.yaml settings.yaml templates $PRE_ZIP_FOLDER/
zip -r $ARTIFACT_PATHNAME $PRE_ZIP_FOLDER
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: theme-hao
path: |
dist/*.zip
retention-days: 7