Skip to content

Fixup max unix timestamp, add doc action (0.3.10) #15

Fixup max unix timestamp, add doc action (0.3.10)

Fixup max unix timestamp, add doc action (0.3.10) #15

Workflow file for this run

name: Build Python Package
on:
push:
branches:
- main
jobs:
build:
name: Build release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set up npm for bundler
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: actions/checkout@v4
- name: Install bundler dependencies
run: >-
npm install
rollup
@rollup/plugin-terser
rollup-plugin-scss
sass
- name: Bundle web scripts and styles
run: >-
node_modules/.bin/rollup -c
ci/rollup.config.app.mjs
- name: Install build tool
run: >-
python3 -m
pip install build --user
- name: Fetch third-party fonts
run: >-
./ci/fetch-fonts.sh
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Get vars
id: get_vars
run: |
asset_name=adi-doctools.tar.gz
echo "asset_name=$asset_name" >> "$GITHUB_ENV"
tag=latest
echo "tag=$tag" >> "$GITHUB_ENV"
release_id=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/latest \
| jq -r .id)
echo "release_id=$release_id" >> "$GITHUB_ENV"
asset_id=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/$release_id/assets | \
jq -r ".[] | select(.name==\"$asset_name\") | .id")
echo "asset_id=$asset_id" >> "$GITHUB_ENV"
- name: Update latest target commitish
id: update_commitish
run: |
curl -s \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"target_commitish": "${{ github.sha }}"}' \
"https://api.github.com/repos/${{ github.repository }}/releases/$release_id"
- name: Upload artifact
id: upload_artifact
run: |
full_asset_name=$(ls dist/adi-doctools-*.tar.gz)
if [[ ! "$asset_id" == "" ]]; then
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id"
fi
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=$asset_name" \
--data-binary "@$full_asset_name"