Check Dev Release #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Dev Release | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight | |
workflow_dispatch: # Allows manual triggering | |
push: | |
branches: | |
- main | |
jobs: | |
check-release: | |
runs-on: ubuntu-latest | |
outputs: | |
current: ${{ steps.check_repo.outputs.current_version }} | |
latest: ${{ steps.check_anaconda.outputs.latest_version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get current version from repo | |
id: check_repo | |
run: | | |
# Read the local version from version.json | |
CURRENT_VERSION=$(jq -r .dev ab_releases/current.json) | |
echo "Current version: $CURRENT_VERSION" | |
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
- name: Get latest version from Anaconda | |
id: check_anaconda | |
run: | | |
# Variables | |
ANACONDA_API_URL="https://api.anaconda.org/package/bsteubing/activity-browser-dev" | |
LABEL="main" | |
# Fetch the package information from Anaconda | |
PACKAGE_INFO=$(curl -s $ANACONDA_API_URL) | |
# Extract the latest version for the specified label | |
LATEST_VERSION=$(echo $PACKAGE_INFO | jq -r --arg LABEL "$LABEL" '.files[] | select(.labels[] == $LABEL) | .version' | sort -V | tail -n 1) | |
echo "Latest version: $LATEST_VERSION" | |
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT | |
build-dev-windows: | |
runs-on: windows-latest | |
needs: check-release | |
if: ${{ needs.check-release.outputs.current != needs.check-release.outputs.latest }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install current environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ab_releases/dev/windows/win-environment-${{needs.check-release.outputs.current}}.txt | |
environment-name: environment | |
- name: Update to latest | |
run: | | |
micromamba install -n environment -c bsteubing -y activity-browser-dev=${{needs.check-release.outputs.latest}} | |
echo micromamba env export --explicit -n environment >> ab_releases/dev/windows/win-environment-${{needs.check-release.outputs.latest}}.txt | |
- name: Upload environment as artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: win-release-spec | |
path: ab_releases/dev/windows/win-environment-${{needs.check-release.outputs.latest}}.txt | |
create-pull-request: | |
runs-on: ubuntu-latest | |
needs: [check-release, build-dev-windows] | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fetch Windows release spec | |
uses: actions/download-artifact@master | |
with: | |
name: win-release-spec | |
path: ab_releases/dev/windows/win-environment-${{needs.check-release.outputs.latest}}.txt | |
- name: Create commit | |
run: | | |
git checkout -b spec-${{needs.check-release.outputs.latest}} | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git add ab_releases/dev/windows/win-environment-${{needs.check-release.outputs.latest}}.txt | |
git commit -a -m "Updated specs to ${{needs.check-release.outputs.latest}}" | |
- name: Create PR | |
run: gh pr create -B spec-${{needs.check-release.outputs.latest}} -H main --title 'Updated windows spec' --body 'Created by Github action' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |