Skip to content

fixup gh token

fixup gh token #11

Workflow file for this run

name: Publish
on:
release:
types: [released]
push:
workflow_dispatch: # allows manual triggering
jobs:
webpage:
name: Update webpage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: release
- name: Configure git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Merge master into release
run: git merge --no-edit origin/master
- name: Fetch latest release artifact
id: latest
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download -p '*.tar.gz' -D release
ls release | sed -ne 's/rules_haskell-\(.*\)[.]tar[.]gz/version=\1/p' >> "${GITHUB_OUTPUT}"
shasum -a 256 release/*.tar.gz | awk '{print "hash=" $1}' >> "${GITHUB_OUTPUT}"
- name: Update hash in start script and docs
run: |
sed -ie '/bazel_dep(name = "rules_haskell"/s/version = "[^"]*"/version = "${{ steps.latest.outputs.version }}"/' start
sed -i \
-e '/cat > WORKSPACE/,/^EOF/{' \
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
-e ' s%url = "[^"]*"%url = "https://github.com/tweag/rules_haskell/releases/download/v${{ steps.latest.outputs.version }}/rules_haskell-${{ steps.latest.outputs.version }}.tar.gz"%' \
-e '}' \
start
sed -i \
-e '/name = "rules_haskell"/,/url = "/{' \
-e ' s%sha256 = "[^"]*"%sha256 = "${{ steps.latest.outputs.hash }}"%; ' \
-e ' s%strip_prefix = "[^"]*"%strip_prefix = "rules_haskell-${{ steps.latest.outputs.version }}"%; ' \
-e ' s%url = "[^"]*"%url = "https://github.com/tweag/rules_haskell/releases/download/v${{ steps.latest.outputs.version }}/rules_haskell-${{ steps.latest.outputs.version }}.tar.gz"%; ' \
-e '}' \
docs/haskell-use-cases.rst
- name: Commit and Push
run: |
git diff
git add start docs/haskell-use-cases.rst
git commit -m "Update rules_haskell in start script and docs to version ${{ steps.latest.outputs.version }}"
git show
#git push