Skip to content

Commit

Permalink
Merge pull request #6 from baking-bad/octez-v19.0-1
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Feb 4, 2024
2 parents c6efbf9 + f4ef30f commit 87a1110
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Publish on Docker Hub

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build
name: Publish on GHCR

on:
push:
tags:
- '*'
- 'v*'

jobs:
build:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/octez_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Check Octez version

on:
schedule:
- cron: '0 0 * * *'
# REMOVE
push:
branches:
- aux/octez-version-checker

jobs:
octez_version:
name: Check the latest Octez release
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Install python-requests
run: sudo apt-get install python3-requests

- name: Check the latest Octez release
run: python3 octez_version.py

- name: Create a PR for new version
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export OCTEZ_VERSION=$(cat octez_version)
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git branch -D octez-$OCTEZ_VERSION || true
git checkout -b octez-$OCTEZ_VERSION
git add .
git commit -m "Update Octez binaries to $OCTEZ_VERSION"
git push --force origin octez-$OCTEZ_VERSION
gh pr create --title "Update Octez binaries to $OCTEZ_VERSION" --body "This PR updates the Octez binaries to the latest version $OCTEZ_VERSION" --base master --head octez-$OCTEZ_VERSION
15 changes: 15 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Tag the current Octez release


on:
push:
branches:
- 'master'

jobs:
build:
name: Force push tag of the current Octez release
runs-on: ubuntu-latest
steps:
- name: make release
run: make release
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TAG=v19.0-1
TAG=`cat octez_version`


build:
Expand Down
1 change: 1 addition & 0 deletions octez_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v19.0-1
36 changes: 36 additions & 0 deletions octez_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pathlib import Path
import requests
from os import environ as env
import subprocess

def run(*args, **kwargs):
print(f"$ {' '.join(args)}")
subprocess.run(args, check=True, **kwargs)


OCTEZ_REPO_URL = 'https://github.com/serokell/tezos-packaging/releases/latest'


def main():
version_file = Path('octez_version')
current_version = version_file.read_text().strip() if version_file.exists() else ''
print(f'Current version: {current_version}')
latest_version = requests.get(OCTEZ_REPO_URL).url.split("/")[-1]
print(f'Latest version: {latest_version}')

if current_version == latest_version:
print('Octez version is up to date.')
exit(1)

if not env.get("GITHUB_ACTIONS"):
print("This script is intended to be run in a GitHub Action.")
exit(2)

print('Octez version has changed. Updating...')
Path('octez_version').write_text(latest_version)

run('make', 'build')
exit(0)

if __name__ == "__main__":
main()

0 comments on commit 87a1110

Please sign in to comment.