Release #23
Workflow file for this run
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| enclave: | |
| type: string | |
| required: true | |
| description: 'Enclave to be released' | |
| options: | |
| - ethereum | |
| - optimism | |
| - parlia | |
| network: | |
| type: string | |
| required: true | |
| default: mainnet | |
| options: | |
| - testnet | |
| - mainnet | |
| description: 'The network on which the enclave runs.' | |
| tag: | |
| type: string | |
| required: true | |
| description: 'Tag Name(e.g. v1.2.3)' | |
| draft: | |
| type: boolean | |
| required: true | |
| default: false | |
| description: 'create a release as draft' | |
| prerelease: | |
| type: boolean | |
| required: true | |
| default: false | |
| description: 'create a release as prerelease' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write # Push Tag and Create Release | |
| packages: write # Push Docker Image to ghcr.io | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if tag exists | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OWNER: ${{ github.repository_owner }} | |
| REPO: ${{ github.event.repository.name }} | |
| TAG: ${{ github.event.inputs.enclave }}-${{ github.event.inputs.network }}-${{ github.event.inputs.tag }} | |
| run: | | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| "https://api.github.com/repos/${OWNER}/${REPO}/git/refs/tags/${TAG}") | |
| if [ "$STATUS" = "200" ]; then | |
| echo "🚫 Tag '${TAG}' already exists." | |
| exit 1 | |
| fi | |
| - name: Configure Git user | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| logout: true | |
| - id: metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }} | |
| tags: | | |
| type=sha,prefix=,format=long | |
| ${{ github.event.inputs.tag }} | |
| - name: Build and Push | |
| uses: docker/build-push-action@v5 | |
| id: docker_build_and_push | |
| with: | |
| context: . | |
| push: true | |
| build-args: | | |
| LCP_ELC_TYPE=${{ github.event.inputs.enclave }} | |
| DEPLOYMENT_NETWORK=${{ github.event.inputs.network }} | |
| tags: ${{ steps.metadata.outputs.tags }} | |
| labels: ${{ steps.metadata.outputs.labels }} | |
| cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}:buildCache | |
| cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}:buildCache,mode=max | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}/${{ github.event.inputs.tag }} | |
| tag_name: ${{ github.event.inputs.enclave }}-${{ github.event.inputs.network }}-${{ github.event.inputs.tag }} | |
| draft: ${{ github.event.inputs.draft }} | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| generate_release_notes: true | |
| append_body: true | |
| body: | | |
| ## Docker Image | |
| 1. Image Digest: ${{ steps.docker_build_and_push.outputs.imageid }} | |
| 2. [Link to Docker Image](https://github.com/${{ github.repository }}/pkgs/container/${{ github.event.repository.name }}%2F${{ github.event.inputs.enclave }}%2F${{ github.event.inputs.network }}?sha256=${{ steps.docker_build_and_push.outputs.digest }}) |