Build Latest Release Candidate #7
This file contains hidden or 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: Build Latest Release Candidate | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
concurrency: | |
group: "latest-rc" | |
jobs: | |
docker_build_and_publish_github: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v5 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
# Get the most recent release candidate from chia-blockchain | |
- uses: actions/github-script@v7 | |
id: 'latest-rc-tag' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: string | |
script: | | |
// Get all releases including pre-releases | |
const releases = await github.rest.repos.listReleases({ | |
owner: 'Chia-Network', | |
repo: 'chia-blockchain', | |
per_page: 20 | |
}); | |
// Find the most recent release candidate (pre-release) | |
const rcRelease = releases.data.find(release => | |
release.prerelease && | |
(release.tag_name.includes('rc') || release.tag_name.includes('RC')) | |
); | |
if (!rcRelease) { | |
throw new Error('No release candidate found'); | |
} | |
console.log(`Found RC: ${rcRelease.tag_name}`); | |
return rcRelease.tag_name; | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/chia-network/chia | |
chianetwork/chia-docker | |
tags: | | |
type=raw,value=latest-rc | |
type=raw,value=${{ steps.latest-rc-tag.outputs.result }} | |
- name: Build docker image and push to github packages | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
no-cache: true | |
push: true | |
build-args: | | |
"BRANCH=${{ steps.latest-rc-tag.outputs.result }}" | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- uses: Chia-Network/actions/github/glue@main | |
with: | |
json_data: '{"chia_ref":"${{ steps.latest-rc-tag.outputs.result }}"}' | |
glue_url: ${{ secrets.GLUE_API_URL }} | |
glue_project: "docker-new-prerelease" | |
glue_path: "trigger" |