Skip to content

Commit e942d41

Browse files
authored
Merge pull request #2128 from ehuss/release-token-perms
deploy: Rewrite and update permissions
2 parents 82ec681 + 9497354 commit e942d41

File tree

3 files changed

+15
-34
lines changed

3 files changed

+15
-34
lines changed

.github/workflows/deploy.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ on:
33
release:
44
types: [created]
55

6+
defaults:
7+
run:
8+
shell: bash
9+
10+
permissions:
11+
contents: write
12+
613
jobs:
714
release:
815
name: Deploy Release
@@ -28,17 +35,14 @@ jobs:
2835
os: windows-latest
2936
steps:
3037
- uses: actions/checkout@master
31-
- name: Install hub
32-
run: ci/install-hub.sh ${{ matrix.os }}
33-
shell: bash
3438
- name: Install Rust
3539
run: ci/install-rust.sh stable ${{ matrix.target }}
36-
shell: bash
37-
- name: Build and deploy artifacts
40+
- name: Build asset
41+
run: ci/make-release-asset.sh ${{ matrix.os }} ${{ matrix.target }}
42+
- name: Update release with new asset
3843
env:
3944
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
run: ci/make-release.sh ${{ matrix.os }} ${{ matrix.target }}
41-
shell: bash
45+
run: gh release upload $MDBOOK_TAG $MDBOOK_ASSET
4246
pages:
4347
name: GitHub Pages
4448
runs-on: ubuntu-latest

ci/install-hub.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

ci/make-release.sh renamed to ci/make-release-asset.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ case $1 in
4444
esac
4545
cd ../..
4646

47-
if [[ -z "$GITHUB_TOKEN" ]]
47+
if [[ -z "$GITHUB_ENV" ]]
4848
then
49-
echo "$GITHUB_TOKEN not set, skipping deploy."
49+
echo "GITHUB_ENV not set, run: gh release upload $TAG target/$asset"
5050
else
51-
hub release edit -m "" --attach $asset $TAG
51+
echo "MDBOOK_TAG=$TAG" >> $GITHUB_ENV
52+
echo "MDBOOK_ASSET=target/$asset" >> $GITHUB_ENV
5253
fi

0 commit comments

Comments
 (0)