-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: push-components | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "The tag to be used when pushing components to the Docker Hub." | ||
required: true | ||
type: string | ||
ref: | ||
description: "The ref (branch or SHA) to process" | ||
required: false | ||
type: string | ||
|
||
defaults: | ||
run: | ||
shell: bash -xe {0} | ||
|
||
jobs: | ||
push-components: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.ref }} # Use the ref if provided, otherwise defaults to the current branch/commit | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v30 | ||
with: | ||
extra_nix_config: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | ||
- name: Populate the nix store | ||
run: nix develop --command echo | ||
- name: Download obelisk | ||
run: | | ||
nix develop --command cargo binstall obelisk --install-path . -y | ||
echo $(pwd) >> $GITHUB_PATH | ||
- name: Log in to Docker Hub | ||
run: | | ||
echo "$DOCKER_HUB_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin | ||
env: | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- name: Run push-components.sh | ||
run: | | ||
which obelisk | ||
nix develop --command ./scripts/push-components.sh $TAG | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
- name: Configure git before push | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
- name: Push obelisk-oci.toml | ||
run: | | ||
git add obelisk-oci.toml | ||
git commit -m "chore: Bump components to $TAG" | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git | ||
git push origin main | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |