Merge pull request #2128 from ehuss/release-token-perms
deploy: Rewrite and update permissions
This commit is contained in:
commit
e942d41c1d
|
@ -3,6 +3,13 @@ on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Deploy Release
|
name: Deploy Release
|
||||||
|
@ -28,17 +35,14 @@ jobs:
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Install hub
|
|
||||||
run: ci/install-hub.sh ${{ matrix.os }}
|
|
||||||
shell: bash
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: ci/install-rust.sh stable ${{ matrix.target }}
|
run: ci/install-rust.sh stable ${{ matrix.target }}
|
||||||
shell: bash
|
- name: Build asset
|
||||||
- name: Build and deploy artifacts
|
run: ci/make-release-asset.sh ${{ matrix.os }} ${{ matrix.target }}
|
||||||
|
- name: Update release with new asset
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: ci/make-release.sh ${{ matrix.os }} ${{ matrix.target }}
|
run: gh release upload $MDBOOK_TAG $MDBOOK_ASSET
|
||||||
shell: bash
|
|
||||||
pages:
|
pages:
|
||||||
name: GitHub Pages
|
name: GitHub Pages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# Installs the `hub` executable into hub/bin
|
|
||||||
set -ex
|
|
||||||
case $1 in
|
|
||||||
ubuntu*)
|
|
||||||
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-linux-amd64-2.12.8.tgz -o hub.tgz
|
|
||||||
mkdir hub
|
|
||||||
tar -xzvf hub.tgz --strip=1 -C hub
|
|
||||||
;;
|
|
||||||
macos*)
|
|
||||||
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-darwin-amd64-2.12.8.tgz -o hub.tgz
|
|
||||||
mkdir hub
|
|
||||||
tar -xzvf hub.tgz --strip=1 -C hub
|
|
||||||
;;
|
|
||||||
windows*)
|
|
||||||
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-windows-amd64-2.12.8.zip -o hub.zip
|
|
||||||
7z x hub.zip -ohub
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "OS should be first parameter, was: $1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$PWD/hub/bin" >> $GITHUB_PATH
|
|
|
@ -44,9 +44,10 @@ case $1 in
|
||||||
esac
|
esac
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
if [[ -z "$GITHUB_TOKEN" ]]
|
if [[ -z "$GITHUB_ENV" ]]
|
||||||
then
|
then
|
||||||
echo "$GITHUB_TOKEN not set, skipping deploy."
|
echo "GITHUB_ENV not set, run: gh release upload $TAG target/$asset"
|
||||||
else
|
else
|
||||||
hub release edit -m "" --attach $asset $TAG
|
echo "MDBOOK_TAG=$TAG" >> $GITHUB_ENV
|
||||||
|
echo "MDBOOK_ASSET=target/$asset" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue