-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: seperate deploy and release assets workflows
Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
- Loading branch information
Showing
2 changed files
with
107 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Generate and publish translations to releases | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
schedule: | ||
# This will run at 00:00 UTC on the first day of every month | ||
- cron: '0 0 1 * *' | ||
workflow_dispatch: | ||
|
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
permissions: | ||
contents: write # to upload assets to releases | ||
|
||
jobs: | ||
translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Fetch sources | ||
run: | | ||
wget https://github.com/tldr-pages/tldr/archive/refs/heads/main.zip --output-document /tmp/main.zip | ||
unzip /tmp/main.zip -d /tmp | ||
- name: Generate CSV dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset --format csv | ||
zip tldr-translations-dataset.zip tldr-translation-pairs-dataset/* | ||
- name: Generate TMX dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-tmx --format tmx | ||
zip tldr-translations-dataset-tmx.zip tldr-translation-pairs-dataset-tmx/* | ||
- name: Generate JSON dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-json --format json | ||
zip tldr-translations-dataset-json.zip tldr-translation-pairs-dataset-json/* | ||
- name: Generate XML dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-xml --format xml | ||
zip tldr-translations-dataset-xml.zip tldr-translation-pairs-dataset-xml/* | ||
- name: Deploy to Release | ||
if: github.repository == 'tldr-pages/tldr-translation-pairs-gen' && github.ref == 'refs/heads/main' | ||
run: | | ||
export RELEASE_TAG="$(git describe --tags --abbrev=0)" | ||
gh release --repo tldr-pages/tldr-translation-pairs-gen upload --clobber "$RELEASE_TAG" -- *.zip |
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,66 +1,48 @@ | ||
name: Generate and publish translations | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
schedule: | ||
# This will run at 00:00 UTC on the first day of every month | ||
- cron: '0 0 1 * *' | ||
workflow_dispatch: | ||
|
||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
permissions: | ||
contents: write # to upload assets to releases | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
jobs: | ||
translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Fetch sources | ||
run: | | ||
wget https://github.com/tldr-pages/tldr/archive/refs/heads/main.zip --output-document /tmp/main.zip | ||
unzip /tmp/main.zip -d /tmp | ||
- name: Generate CSV dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset --format csv | ||
zip tldr-translations-dataset.zip tldr-translation-pairs-dataset/* | ||
- name: Generate TMX dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-tmx --format tmx | ||
zip tldr-translations-dataset-tmx.zip tldr-translation-pairs-dataset-tmx/* | ||
- name: Generate JSON dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-json --format json | ||
zip tldr-translations-dataset-json.zip tldr-translation-pairs-dataset-json/* | ||
- name: Generate XML dataset | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output tldr-translation-pairs-dataset-xml --format xml | ||
zip tldr-translations-dataset-xml.zip tldr-translation-pairs-dataset-xml/* | ||
- name: Deploy to Release | ||
if: github.repository == 'tldr-pages/tldr-translation-pairs-gen' && github.ref == 'refs/heads/main' | ||
run: | | ||
export RELEASE_TAG="$(git describe --tags --abbrev=0)" | ||
gh release --repo tldr-pages/tldr-translation-pairs-gen upload --clobber "$RELEASE_TAG" -- *.zip | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
- name: Initialize project | ||
run: | | ||
npm ci | ||
- name: Build | ||
run: | | ||
npm run build | ||
- name: Fetch sources | ||
run: | | ||
wget https://github.com/tldr-pages/tldr/archive/refs/heads/main.zip --output-document /tmp/main.zip | ||
unzip /tmp/main.zip -d /tmp | ||
- name: Execute | ||
run: | | ||
npm run tldr-translation-pairs-gen -- --source /tmp/tldr-main --output /tmp/datasets | ||
- name: Package artifacts | ||
run: | | ||
mkdir /tmp/dist | ||
tar czf /tmp/dist/tldr-pages-translation-pairs.tar.gz --directory /tmp datasets | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: /tmp/dist | ||
|
||
deploy: | ||
needs: translations | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write | ||
id-token: write | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |