From 160b59a9a38c2319e6babc99a4b20ed20a087908 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Sat, 15 Jul 2023 15:50:07 +0200 Subject: [PATCH] Trying out GitHub Actions --- .github/actions/setup-for-build/action.yaml | 39 ++++++++++++++++ .github/workflows/build.yaml | 52 +++++++++++++++++++++ .gitignore | 1 + GitVersion.yml | 7 +++ 4 files changed, 99 insertions(+) create mode 100644 .github/actions/setup-for-build/action.yaml create mode 100644 .github/workflows/build.yaml create mode 100644 GitVersion.yml diff --git a/.github/actions/setup-for-build/action.yaml b/.github/actions/setup-for-build/action.yaml new file mode 100644 index 0000000..3e6098c --- /dev/null +++ b/.github/actions/setup-for-build/action.yaml @@ -0,0 +1,39 @@ +name: "Setup project" +runs: + using: "composite" + steps: + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: "7.0.x" + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: "5.x" + + - name: Determine Version + uses: gittools/actions/gitversion/execute@v0 + id: version + + - name: Use the version + run: | + echo SZ_VERSION="${{ steps.version.outputs.AssemblySemFileVer }}" >> $GITHUB_ENV + echo SZ_VERSION_NAME="${{ steps.version.outputs.InformationalVersion }}" >> $GITHUB_ENV + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Linter + run: pnpm lint diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ca473e4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,52 @@ +name: Build release +on: [push] +jobs: + build_chrome: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup-for-build + + - name: Build + run: pnpm build + + - name: Pack ZIP + run: pnpm pack:zip + + - uses: actions/upload-artifact@v3 + with: + name: extension-zip + path: extension.zip + + build_firefox: + runs-on: ubuntu-20.04 + # Doesn't really need the Chrome build, but we can reuse its cache. + needs: build_chrome + if: github.ref == 'refs/heads/master' + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup-for-build + + - name: Build + run: pnpm build + env: + SZ_GECKO_ID: 13372607-2257-4360-8f51-5ce66fa73350 + + - name: Sign XPI + run: pnpm sign:firefox + env: + WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }} + WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }} + + - uses: actions/upload-artifact@v3 + with: + name: extension-xpi + path: web-ext-artifacts/*.xpi diff --git a/.gitignore b/.gitignore index 562a8c7..496bc3f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ extension/manifest.json node_modules src/auto-imports.d.ts src/components.d.ts +*artifacts/ diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..1498728 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,7 @@ +mode: ContinuousDelivery +increment: None +assembly-file-versioning-format: "{Major}.{Minor}.{Patch}.{CommitsSinceVersionSource}" +branches: {} +ignore: + sha: [] +merge-message-formats: {}