Skip to content

Commit 251fcbf

Browse files
committed
Fix rclone R2 integration and simplify dry-run
- Use RCLONE_CONFIG_R2_* env vars for R2 remote config - Skip npm publish, GitHub release, R2 upload on workflow_dispatch - Only set version from tag when triggered by tag push - Make R2 download non-fatal with continue-on-error
1 parent 6a54ffb commit 251fcbf

1 file changed

Lines changed: 20 additions & 33 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ on:
55
tags:
66
- '[0-9]+.[0-9]+.[0-9]+'
77
workflow_dispatch:
8-
inputs:
9-
dry-run:
10-
description: 'Dry run (npm --dry-run, draft release, skip R2 upload)'
11-
type: boolean
12-
default: true
138

149
env:
1510
PKG_CACHE_PATH: .pkg
16-
DRY_RUN: ${{ inputs.dry-run || false }}
1711

1812
jobs:
1913
release:
@@ -25,6 +19,7 @@ jobs:
2519
- uses: actions/checkout@v6
2620

2721
- name: Set version from tag
22+
if: github.ref_type == 'tag'
2823
run: |
2924
sed -i "s/0.0.0/${GITHUB_REF_NAME}/g" package.json src/index.ts
3025
@@ -48,18 +43,14 @@ jobs:
4843
run: sudo apt-get update && sudo apt-get install -y rclone
4944

5045
- name: Download existing ppa from R2
51-
run: |
52-
rclone copy r2:${R2_BUCKET}/ ppa/ \
53-
--s3-provider=Cloudflare \
54-
--s3-access-key-id="${R2_ACCESS_KEY_ID}" \
55-
--s3-secret-access-key="${R2_SECRET_ACCESS_KEY}" \
56-
--s3-endpoint="${R2_ENDPOINT}" \
57-
--s3-no-check-bucket
46+
run: rclone copy r2:${R2_BUCKET}/ ppa/
5847
env:
59-
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
60-
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
61-
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
62-
R2_BUCKET: ${{ secrets.R2_BUCKET }}
48+
RCLONE_CONFIG_R2_TYPE: s3
49+
RCLONE_CONFIG_R2_PROVIDER: Cloudflare
50+
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
51+
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
52+
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
53+
RCLONE_CONFIG_R2_NO_CHECK_BUCKET: true
6354

6455
- name: Import GPG key and preset passphrase
6556
run: |
@@ -78,26 +69,22 @@ jobs:
7869
run: ./publish-deb
7970

8071
- name: Publish to npm
81-
run: npm publish --provenance ${{ env.DRY_RUN == 'true' && '--dry-run' || '' }}
72+
if: github.ref_type == 'tag'
73+
run: npm publish --provenance
8274

8375
- name: Create GitHub Release
84-
run: >
85-
gh release create "${GITHUB_REF_NAME}" bin/*.gz --generate-notes
86-
${{ env.DRY_RUN == 'true' && '--draft' || '' }}
76+
if: github.ref_type == 'tag'
77+
run: gh release create "${GITHUB_REF_NAME}" bin/*.gz --generate-notes
8778
env:
8879
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8980

9081
- name: Upload ppa to Cloudflare R2
91-
if: env.DRY_RUN != 'true'
92-
run: |
93-
rclone copy ppa/ r2:${R2_BUCKET}/ \
94-
--s3-provider=Cloudflare \
95-
--s3-access-key-id="${R2_ACCESS_KEY_ID}" \
96-
--s3-secret-access-key="${R2_SECRET_ACCESS_KEY}" \
97-
--s3-endpoint="${R2_ENDPOINT}" \
98-
--s3-no-check-bucket
82+
if: github.ref_type == 'tag'
83+
run: rclone copy ppa/ r2:${R2_BUCKET}/
9984
env:
100-
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
101-
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
102-
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
103-
R2_BUCKET: ${{ secrets.R2_BUCKET }}
85+
RCLONE_CONFIG_R2_TYPE: s3
86+
RCLONE_CONFIG_R2_PROVIDER: Cloudflare
87+
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
88+
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
89+
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
90+
RCLONE_CONFIG_R2_NO_CHECK_BUCKET: true

0 commit comments

Comments
 (0)