|
| 1 | +name: push-components |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: "The tag to be used when pushing components to the Docker Hub." |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + ref: |
| 14 | + description: "The ref (branch or SHA) to process" |
| 15 | + required: true |
| 16 | + type: string |
| 17 | + default: "main" |
| 18 | + |
| 19 | +defaults: |
| 20 | + run: |
| 21 | + shell: bash -xe {0} |
| 22 | + |
| 23 | +jobs: |
| 24 | + push-components: |
| 25 | + runs-on: ubuntu-24.04 |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v5 |
| 28 | + with: |
| 29 | + ref: ${{ github.event.inputs.ref }} # Use the ref if provided, otherwise defaults to the current branch/commit |
| 30 | + |
| 31 | + - uses: nixbuild/nix-quick-install-action@v34 |
| 32 | + with: |
| 33 | + github_access_token: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + nix_conf: | |
| 35 | + extra-substituters = https://cache.garnix.io |
| 36 | + extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g |
| 37 | + - name: Populate the nix store |
| 38 | + run: | |
| 39 | + nix develop --command echo |
| 40 | +
|
| 41 | + - name: Log in to Docker Hub |
| 42 | + run: | |
| 43 | + echo "$DOCKER_HUB_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin |
| 44 | + env: |
| 45 | + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 46 | + DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} |
| 47 | + |
| 48 | + - name: Run push-components.sh |
| 49 | + run: | |
| 50 | + nix develop --command ./scripts/push-components.sh $TAG |
| 51 | + env: |
| 52 | + TAG: ${{ github.event.inputs.tag }} |
| 53 | + |
| 54 | + - name: Configure git before push |
| 55 | + run: | |
| 56 | + git config user.name "github-actions[bot]" |
| 57 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 58 | +
|
| 59 | + - name: Push obelisk-oci.toml |
| 60 | + run: | |
| 61 | + git add obelisk-oci.toml |
| 62 | + git commit -m "chore: Bump components to $TAG" |
| 63 | + git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git |
| 64 | + git push origin ${{ github.event.inputs.ref }} |
| 65 | + env: |
| 66 | + TAG: ${{ github.event.inputs.tag }} |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments