Skip to content

Commit

Permalink
feat: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkz committed Nov 20, 2024
1 parent a21e018 commit d73ae4f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Releases

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
- run: pnpm install
- run: node cli.js

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: '0.4.27'
- name: Release
run: uv run --frozen release.py
- uses: ncipollo/[email protected]
with:
artifacts: 'release/*.apkg'
artifactErrorsFailBuild: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lerna-debug.log*

node_modules
dist
release
dist-ssr
*.local

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "anki-templates",
"type": "module",
"version": "1.0.6",
"version": "1.0.7",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
8 changes: 7 additions & 1 deletion release.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import genanki
import json
import os

with open("./templates.json") as file:
templates_config = json.load(file)
Expand Down Expand Up @@ -40,8 +41,13 @@ def gen_apkg(id: str, locale: str):
),
)
deck.add_note(note)
genanki.Package(deck).write_to_file(f"{folder}/release.apkg")

genanki.Package(deck).write_to_file(
f"release/{template['name']} Template [{locale}].apkg"
)


os.makedirs("release", exist_ok=True)

for id in templates_config.keys():
for locale in ["zh", "en"]:
Expand Down

0 comments on commit d73ae4f

Please sign in to comment.