Skip to content

Commit

Permalink
utilize workflow permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
allddd committed Dec 6, 2023
1 parent b383273 commit 992fde5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- cron: '0 */6 * * *'
workflow_dispatch:

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -18,4 +21,3 @@ jobs:
shell: bash
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
SSH_KEY: ${{ secrets.SSH_KEY }}
11 changes: 3 additions & 8 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -eo pipefail

if [[ -z "${GPG_KEY}" || -z "${SSH_KEY}" ]]; then
echo 'ERROR: GPG/SSH_KEY is not defined.'
if [[ -z "${GPG_KEY}" ]]; then
echo 'ERROR: GPG_KEY is not defined.'
exit 1
fi

Expand Down Expand Up @@ -42,15 +42,10 @@ mv ./meta/dists ./meta/pool ./
echo -n "${REMOTE_VER}" > ./VERSION

echo 'Pushing changes...'
eval "$(ssh-agent -s)"
echo "${SSH_KEY}" | ssh-add - > /dev/null
mkdir -p ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
git remote set-url origin '[email protected]:allddd/headscale-apt.git'
git config --global user.email '117767298+github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
git add dists pool VERSION
git commit -m "${REMOTE_VER}"
git push -u origin main
git push

# vim: ts=4 sw=4 et:

0 comments on commit 992fde5

Please sign in to comment.