This commit is contained in:
tree 2023-02-05 14:53:01 +01:00
rodič d5929e5fbb
revize 6327fa27e6
6 změnil soubory, kde provedl 85 přidání a 25 odebrání

Zobrazit soubor

@ -1,37 +1,82 @@
name: Test, build, deploy
env:
ENTRY: 23
GH_PAGES_DOMAIN: data.prgblockweek.com
on:
push:
branches:
- main # Set a branch to deploy
pull_request:
- main
jobs:
deploy:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
outputs:
tag: ${{ env.TAG }}
steps:
- name: Setup repo
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Deno
#uses: denoland/setup-deno@v1
uses: denoland/setup-deno@9db7f66e8e16b5699a514448ce994936c63f0d54
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Prague"
- name: Build sources
run: make
# - name: Build changelog
# run: make changelog
- name: List ./dist
run: find dist
- name: Add custom domain
run: "touch dist/CNAME && echo \"data.prgblockweek.com\" >> dist/CNAME"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- run: make
- run: find dist
- run: "deno run --allow-run utils/tag.js >> $GITHUB_ENV"
- run: "echo \"${{ env.TAG }}\" >> ./dist/TAG"
- run: "echo \"Builded Tag: ${{ env.TAG }}\""
- uses: montudor/action-zip@v1
- run: "zip -qq -r release.zip dist"
- uses: actions/upload-artifact@v3
with:
name: release
path: release.zip
release:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- run: "echo \"TAG=${{ needs.build.outputs.tag }}\" >> $GITHUB_ENV"
- run: "echo \"Tag: ${{ env.TAG }}\""
- uses: actions/download-artifact@v3
with:
name: release
- uses: montudor/action-zip@v1
- run: unzip -qq release.zip
- run: "zip -qq -r ../pbw-${{ env.ENTRY }}-${{ env.TAG }}.zip ${{ env.ENTRY }}"
working-directory: ./dist
- uses: rickstaa/action-create-tag@v1
with:
tag: "${{ env.TAG }}"
message: "Latest release"
github_token: '${{ secrets.GITHUB_TOKEN }}'
- uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.TAG }}"
name: "${{ env.TAG }}"
body: "This is a automated release."
draft: false
prerelease: false
files: |
pbw-${{ env.ENTRY }}-${{ env.TAG }}.zip
pages:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: release
- uses: montudor/action-zip@v1
- run: unzip -qq release.zip
- run: find dist
- run: "touch dist/CNAME && echo \"${{ env.GH_PAGES_DOMAIN }}\" >> dist/CNAME"
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_dir: ./dist

1
.gitignore vendorováno
Zobrazit soubor

@ -2,3 +2,4 @@
dist
dist-mirror
cache
.env

Zobrazit soubor

@ -1,5 +1,4 @@
pipeline:
build_mirror:
image: denoland/deno
commands:
@ -7,11 +6,13 @@ pipeline:
- apt install make
- deno --version
- make mirror
when:
branch: [main]
deploy_mirror:
image: rclone/rclone
commands:
- "rclone sync dist-mirror/ :sftp:data/ --sftp-host frontier.gwei.cz --sftp-user pbw-deploy --sftp-port 2022 --sftp-pass $RCLONE_PASS -v"
secrets: [RCLONE_PASS]
when:
branch: [main]
branch: [main]
branches: [main]

Zobrazit soubor

@ -23,3 +23,6 @@ build-mirror:
event-sync:
deno run --unstable --allow-read --allow-write --allow-net utils/eventSync.js $(event)
tag:
deno run --unstable --allow-run utils/tag.js

Zobrazit soubor

@ -10,7 +10,8 @@ to coordinate event listings.
- 💽 Data: [data.prgblockweek.com](https://data.prgblockweek.com)
- 🕵️ Explore: [explore.prgblockweek.com](https://explore.prgblockweek.com/)
You can use JSON Hero to view the data: [`/23/index.json` @ JSON Hero](https://jsonhero.io/new?url=https://data.prgblockweek.com/23/index.json)
You can use JSON Hero to view the data:
[`/23/index.json` @ JSON Hero](https://jsonhero.io/new?url=https://data.prgblockweek.com/23/index.json)
## Follow us!

9
utils/tag.js Normal file
Zobrazit soubor

@ -0,0 +1,9 @@
const d = new Date();
const tag = `v${d.getFullYear()}.${("0" + (d.getMonth() + 1)).slice(-2)}.${
("0" + d.getDate()).slice(-2)
}`;
const p = Deno.run({ cmd: ["git", "tag"], stdout: "piped" });
const current = String.fromCharCode.apply(null, await p.output()).trim();
const m = current.match(new RegExp(`${tag}`, "g"));
const num = m ? m.length : 0;
console.log(`TAG=${tag}-r${num}`);