From 2d8fb8bad93358f8f7deec79f956ec9c25b5d791 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 9 Feb 2025 11:18:03 +0100 Subject: [PATCH] feat(ci): publish desktop releases with GitHub actions only --- .drone.yml | 211 +--------------------------------- .github/workflows/release.yml | 18 ++- desktop/build.js | 1 + 3 files changed, 16 insertions(+), 214 deletions(-) diff --git a/.drone.yml b/.drone.yml index 67ef78f86..1233aadb9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1163,7 +1163,6 @@ steps: - wget https://dl.vikunja.io/frontend/vikunja-frontend-$$VERSION.zip - unzip vikunja-frontend-$$VERSION.zip -d frontend - sed -i 's/\\/api\\/v1//g' frontend/index.html - - ./bumpp.sh - npm install -g corepack && corepack enable && pnpm config set store-dir .cache/pnpm - pnpm install --fetch-timeout 100000 - pnpm dist --linux zip @@ -1188,216 +1187,8 @@ steps: # depends_on: # - build ---- -kind: pipeline -type: docker -name: desktop-release - -depends_on: - - frontend-release-unstable - - frontend-release-version - -trigger: - ref: - - refs/heads/main - - "refs/tags/**" - event: - exclude: - - cron - -steps: - - name: fetch-tags - image: docker:git - commands: - - git fetch --tags - - # - name: restore-cache - # image: meltwater/drone-cache:dev - # pull: true - # environment: - # AWS_ACCESS_KEY_ID: - # from_secret: cache_aws_access_key_id - # AWS_SECRET_ACCESS_KEY: - # from_secret: cache_aws_secret_access_key - # settings: - # restore: true - # bucket: kolaente.dev-drone-dependency-cache - # endpoint: https://fsn1.your-objectstorage.com - # region: fsn1 - # path_style: true - # cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}' - # mount: - # - '.cache' - - - name: build - image: electronuserland/builder:wine - pull: true - environment: - PNPM_CACHE_FOLDER: .cache/pnpm - depends_on: - - fetch-tags - # - restore-cache - commands: - - cd desktop - - export VERSION=${DRONE_TAG##v} - - if [ -z "$$VERSION" ]; then export VERSION=unstable; fi - # TODO: Move to a yarn script - - wget https://dl.vikunja.io/frontend/vikunja-frontend-$$VERSION.zip - - unzip vikunja-frontend-$$VERSION.zip -d frontend - - sed -i 's/\\/api\\/v1//g' frontend/index.html - - ./bumpp.sh - - npm install -g corepack && corepack enable && pnpm config set store-dir .cache/pnpm - - pnpm install --fetch-timeout 100000 - - pnpm dist --linux --windows - - # - name: rebuild-cache - # image: meltwater/drone-cache:dev - # pull: true - # environment: - # AWS_ACCESS_KEY_ID: - # from_secret: cache_aws_access_key_id - # AWS_SECRET_ACCESS_KEY: - # from_secret: cache_aws_secret_access_key - # settings: - # rebuild: true - # bucket: kolaente.dev-drone-dependency-cache - # endpoint: https://fsn1.your-objectstorage.com - # region: fsn1 - # path_style: true - # cache_key: '{{ .Repo.Name }}_{{ checksum "desktop/yarn.lock" }}_{{ arch }}_{{ os }}' - # mount: - # - '.cache' - # depends_on: - # - build - - - name: rename-unstable - image: bash - pull: true - commands: - - cd desktop/dist - - bash -c 'for file in Vikunja*; do suffix=".$${file##*.}"; if [[ ! -d $file ]]; then mv "$file" "Vikunja-Desktop-unstable$${suffix}"; fi; done' - depends_on: - - build - when: - event: - exclude: - - tag - - - name: release-unstable - image: plugins/s3 - pull: true - settings: - bucket: vikunja - access_key: - from_secret: hetzner_access_key_id - secret_key: - from_secret: hetzner_secret_access_key - endpoint: https://fsn1.your-objectstorage.com - region: fsn1 - path_style: true - strip_prefix: desktop/dist/ - source: desktop/dist/Vikunja-Desktop* - target: /desktop/unstable/ - when: - event: - exclude: - - tag - depends_on: - - rename-unstable - - - name: release-version - image: plugins/s3 - pull: true - settings: - bucket: vikunja - access_key: - from_secret: hetzner_access_key_id - secret_key: - from_secret: hetzner_secret_access_key - endpoint: https://fsn1.your-objectstorage.com - region: fsn1 - path_style: true - strip_prefix: desktop/dist/ - source: desktop/dist/* - target: /desktop/${DRONE_TAG##v}/ - when: - event: - - tag - depends_on: [ build ] - -# Disabled until we have a working mac runner -#--- -#kind: pipeline -#type: exec -#name: desktop-release-macos -# -#trigger: -# ref: -# - refs/heads/main -# - "refs/tags/**" -# -#platform: -# os: darwin -# arch: amd64 -# -#steps: -# - name: build -# environment: -# ACCESS_KEY: -# from_secret: hetzner_access_key_id -# SECRET_KEY: -# from_secret: hetzner_secret_access_key -# commands: -# - git fetch --tags -# - export VERSION=${DRONE_TAG##v} -# - if [ -z "$$VERSION" ]; then export VERSION=unstable; fi -# # TODO: Move to a yarn script -# - wget https://dl.vikunja.io/frontend/vikunja-frontend-$$VERSION.zip -# - unzip vikunja-frontend-$$VERSION.zip -d frontend -# - sed -i '' 's/\\/api\\/v1//g' frontend/index.html -# # Make sure that the -unstable suffix is added to release files -# - sed -i '' "s/\$${version}/$$VERSION/g" package.json -# - yarn install -# - yarn dist --mac -# - mc config host add scw-fsn1 https://fsn1.your-objectstorage.com $ACCESS_KEY $SECRET_KEY --api S3v4 -# - mc cp ./dist/*.dmg scw-fsn1/vikunja/desktop/$VERSION/ -# - mc cp ./dist/*.dmg.blockmap scw-fsn1/vikunja/desktop/$VERSION/ - ---- -kind: pipeline -type: docker -name: notify - -trigger: - ref: - - refs/heads/main - - "refs/tags/**" - event: - exclude: - - cron - -depends_on: - - build-and-test - - release - - docker-release - - desktop-release - -steps: - - name: notify - image: plugins/matrix - settings: - homeserver: https://matrix.org - roomid: WqBDCxzghKcNflkErL:matrix.org - username: - from_secret: matrix_username - password: - from_secret: matrix_password - when: - status: - - success - - failure --- kind: signature -hmac: 08f93847c405bf7b6f50ab3deb19a39aa69645313a936e632fdb3d4a35e74d83 +hmac: df9858e2b37dfddccd4892f007bbe69a61321352e94ebcf6adf82fa6560665bb ... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbd81abf4..1656bd6e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,14 +54,24 @@ jobs: node-version: 22 cache: pnpm cache-dependency-path: desktop/pnpm-lock.yaml + - name: Install Linux dependencies + if: ${{ runner.os == 'Linux' }} + run: sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools - name: Build desktop app working-directory: desktop run: | pnpm install --fetch-timeout 100000 # TODO use the built output from a previous frontend build step node build.js "${{ steps.ghd.outputs.describe }}" ${{ github.ref_type == 'tag' }} - - name: Store release as artifact - uses: actions/upload-artifact@v4 + - name: Upload to S3 + uses: kolaente/s3-action@v1.0.1 with: - name: desktop-release-${{ runner.os }} - path: desktop/dist/Vikunja* + s3-access-key-id: ${{ secrets.HETZNER_S3_ACCESS_KEY }} + s3-secret-access-key: ${{ secrets.HETZNER_S3_SECRET_KEY }} + s3-endpoint: 'https://fsn1.your-objectstorage.com' + s3-bucket: 'vikunja' + files: 'desktop/dist/Vikunja*' + target-path: /desktop/${{ github.ref_type == 'tag' && steps.ghd.outputs.describe || 'unstable' }} + s3-region: 'fsn1' + strip-path-prefix: desktop/dist/ + exclude: 'desktop/dist/*.blockmap' diff --git a/desktop/build.js b/desktop/build.js index dca142162..b00c737cf 100644 --- a/desktop/build.js +++ b/desktop/build.js @@ -115,6 +115,7 @@ async function main() { console.log('All steps completed successfully!') } catch (err) { console.error('An error occurred:', err.message) + process.exit(1) } finally { // Cleanup the zip file if (fs.existsSync(zipFilePath)) {