Use Gitea Actions to build and publish theme (#123)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-on: https://gitea.com/gitea/theme/pulls/123
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-committed-by: techknowlogick <techknowlogick@noreply.gitea.io>
This commit is contained in:
techknowlogick 2023-03-07 20:06:40 +08:00 committed by Lunny Xiao
parent aa3c84e28b
commit 0de5dfc0fe
4 changed files with 55 additions and 60 deletions

View File

@ -1,59 +0,0 @@
---
kind: pipeline
name: default
platform:
os: linux
arch: arm64
steps:
- name: build
pull: always
image: node:latest
commands:
- npm install
- npm run clean
- npm run build
- npm run release
- name: release
pull: always
image: woodpeckerci/plugin-s3:latest
settings:
acl:
from_secret: aws_s3_acl
region:
from_secret: aws_s3_region
bucket:
from_secret: aws_s3_bucket
endpoint:
from_secret: aws_s3_endpoint
path_style:
from_secret: aws_s3_path_style
strip_prefix: dist/
source: dist/master.tar.gz
target: /theme
environment:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key
when:
event:
- push
- name: discord
pull: always
image: appleboy/drone-discord:1
environment:
DISCORD_WEBHOOK_ID:
from_secret: discord_webhook_id
DISCORD_WEBHOOK_TOKEN:
from_secret: discord_webhook_token
when:
event:
- push
- tag
status:
- changed
- failure

View File

@ -0,0 +1,19 @@
name: dry run building theme
run-name: dry-run
on: [pull_request]
jobs:
dry-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: build npm
run: |
npm ci
npm run clean
npm run build
npm run release

View File

@ -0,0 +1,35 @@
name: Build and Publish Theme
run-name: build-and-publish
on:
push:
branches:
- main
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: install aws cli
run: |
apt update -y && apt install -y python python3-pip
pip install awscli
- name: build npm
run: |
npm ci
npm run clean
npm run build
npm run release
- name: aws credential configure
uses: https://github.com/aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Copy files to the production website with the AWS CLI
run: |
aws s3 cp dist/main.tar.gz s3://dl-gitea-com/theme/

View File

@ -35,7 +35,7 @@ gulp.task('watch', function () {
gulp.task('release', function () {
return gulp.src(sources)
.pipe(tar('master.tar'))
.pipe(tar('main.tar'))
.pipe(gzip())
.pipe(gulp.dest('dist'))
});