Check Online Version #260
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 Online Version" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
get_versions: | |
name: Get Versions | |
runs-on: ubuntu-latest | |
outputs: | |
current_panel_version: ${{ steps.current_versions.outputs.panel_version }} | |
current_daemon_version: ${{ steps.current_versions.outputs.daemon_version }} | |
latest_panel_version: ${{ steps.latest_versions.outputs.panel_version }} | |
latest_daemon_version: ${{ steps.latest_versions.outputs.daemon_version}} | |
steps: | |
- name: Get Current Release | |
id: latest_versions | |
run: | | |
latest_info="$(curl -s "https://cdn.pterodactyl.io/releases/latest.json")" | |
echo "::set-output name=panel_version::v$(echo $latest_info | jq -r '.panel')" | |
echo "::set-output name=daemon_version::v$(echo $latest_info | jq -r '.wings')" | |
- name: Get repository name | |
id: repo_name | |
run: echo "::set-output name=repository::$(echo ${{ github.repository }} | cut -d'/' -f 2)" | |
- name: Get Panel Docker version | |
uses: octokit/[email protected] | |
id: panel_docker_version | |
with: | |
route: GET /orgs/{org}/packages/{package_type}/{package_name}/versions | |
org: ${{ github.repository_owner }} | |
package_type: container | |
package_name: ${{ steps.repo_name.outputs.repository }}/panel | |
per_page: 1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Daemon Docker version | |
uses: octokit/[email protected] | |
id: daemon_docker_version | |
with: | |
route: GET /orgs/{org}/packages/{package_type}/{package_name}/versions | |
org: ${{ github.repository_owner }} | |
package_type: container | |
package_name: ${{ steps.repo_name.outputs.repository }}/daemon | |
per_page: 1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Docker versions | |
id: current_versions | |
run: | | |
echo "::set-output name=panel_version::$(echo '${{ steps.panel_docker_version.outputs.data }}' | jq -r '.[0].metadata.container.tags[]|select(startswith("v"))')" | |
echo "::set-output name=daemon_version::$(echo '${{ steps.daemon_docker_version.outputs.data }}' | jq -r '.[0].metadata.container.tags[]|select(startswith("v"))')" | |
update-version-txt: | |
name: Update version.txt | |
runs-on: ubuntu-latest | |
needs: get_versions | |
if: needs.get_versions.outputs.latest_panel_version != needs.get_versions.outputs.current_panel_version || needs.get_versions.outputs.latest_daemon_version != needs.get_versions.outputs.current_daemon_version | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
echo -e "PANEL_VERSION=${{ needs.get_versions.outputs.latest_panel_version }}\nDAEMON_VERSION=${{ needs.get_versions.outputs.latest_daemon_version }}" > ./manifest/version.txt | |
git commit -a -m "updated version.txt." | |
git push | |
request_daemon_build: | |
name: Request Daemon Build | |
runs-on: ubuntu-latest | |
needs: | |
- get_versions | |
- update-version-txt | |
steps: | |
- uses: convictional/[email protected] | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: pterodactyl-containers | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow_file_name: update-daemon.yml | |
ref: master | |
trigger_workflow: true | |
wait_workflow: false | |
request_panel_build: | |
name: Request Panel Build | |
runs-on: ubuntu-latest | |
needs: | |
- get_versions | |
- update-version-txt | |
steps: | |
- uses: convictional/[email protected] | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: pterodactyl-containers | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow_file_name: update-panel.yml | |
ref: master | |
trigger_workflow: true | |
wait_workflow: false |