-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from baking-bad/octez-v19.0-1
- Loading branch information
Showing
7 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build | ||
name: Publish on Docker Hub | ||
|
||
on: | ||
push: | ||
|
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
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: | ||
|
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
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 "[email protected]" | ||
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 |
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
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
TAG=v19.0-1 | ||
TAG=`cat octez_version` | ||
|
||
|
||
build: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v19.0-1 |
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
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() |