diff --git a/.github/workflows/act_init.yaml b/.github/workflows/act_init.yaml new file mode 100644 index 0000000..81045d0 --- /dev/null +++ b/.github/workflows/act_init.yaml @@ -0,0 +1,53 @@ +name: ACT Build Init +runs: + using: "composite" + steps: + - name: Set image tag for release + if: github.event_name == 'release' + run: | + echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set image tag for main + if: github.ref == 'refs/heads/main' && github.event_name != 'release' + run: | + echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV + + - name: Set image tag and expiration for dev + if: github.ref != 'refs/heads/main' && github.event_name != 'release' + run: | + export commit_hash=${{ github.sha }} + echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV + echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV + + - name: Checkout this project + uses: actions/checkout@v4 + + - name: arcaflow-container-toolkit-action + uses: arcalot/arcaflow-container-toolkit-action@v1.3.0 + with: + image_name: ${{ inputs.image_name }} + image_tag: ${{ inputs.image_tag }} + github_username: ${{ inputs.github_username }} + github_password: ${{ secrets.GITHUB_TOKEN }} + github_namespace: ${{ inputs.github_namespace }} + quay_username: ${{ secrets.QUAY_USERNAME }} + quay_password: ${{ secrets.QUAY_PASSWORD }} + quay_namespace: ${{ secrets.QUAY_NAMESPACE }} + quay_custom_namespace: ${{ inputs.quay_custom_namespace }} + quay_img_exp: ${{ inputs.quay_img_exp }} + build_timeout: ${{ inputs.build_timeout }} + archetype: ${{ inputs.archetype }} + req_check_only: ${{ inputs.multi_arch }} + + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Log in to quay.io for multi-arch + if: ${{ inputs.multi_arch }} + uses: redhat-actions/podman-login@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} diff --git a/.github/workflows/reusable_workflow.yaml b/.github/workflows/reusable_workflow.yaml index f7c3a45..b4b5124 100644 --- a/.github/workflows/reusable_workflow.yaml +++ b/.github/workflows/reusable_workflow.yaml @@ -35,32 +35,67 @@ on: required: false jobs: - act-build: - name: Build ${{ github.ref_name }} from ${{ github.event_name }} - runs-on: ubuntu-latest - steps: - - name: Set image tag for release - if: github.event_name == 'release' - run: | - echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + # act-init: + # name: Init ${{ github.ref_name }} from ${{ github.event_name }} + # runs-on: ubuntu-latest + # steps: + # - name: Set image tag for release + # if: github.event_name == 'release' + # run: | + # echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Set image tag for main - if: github.ref == 'refs/heads/main' && github.event_name != 'release' - run: | - echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV + # - name: Set image tag for main + # if: github.ref == 'refs/heads/main' && github.event_name != 'release' + # run: | + # echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV - - name: Set image tag and expiration for dev - if: github.ref != 'refs/heads/main' && github.event_name != 'release' - run: | - export commit_hash=${{ github.sha }} - echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV - echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV + # - name: Set image tag and expiration for dev + # if: github.ref != 'refs/heads/main' && github.event_name != 'release' + # run: | + # export commit_hash=${{ github.sha }} + # echo "IMAGE_TAG=${GITHUB_REF##*/}_${commit_hash:0:7}" >> $GITHUB_ENV + # echo "QUAY_IMG_EXP=90d" >> $GITHUB_ENV - - name: Checkout this project - uses: actions/checkout@v4 + # - name: Checkout this project + # uses: actions/checkout@v4 - - name: arcaflow-container-toolkit-action - uses: arcalot/arcaflow-container-toolkit-action@v1.3.0 + # - name: arcaflow-container-toolkit-action + # uses: arcalot/arcaflow-container-toolkit-action@v1.3.0 + # with: + # image_name: ${{ inputs.image_name }} + # image_tag: ${{ inputs.image_tag }} + # github_username: ${{ inputs.github_username }} + # github_password: ${{ secrets.GITHUB_TOKEN }} + # github_namespace: ${{ inputs.github_namespace }} + # quay_username: ${{ secrets.QUAY_USERNAME }} + # quay_password: ${{ secrets.QUAY_PASSWORD }} + # quay_namespace: ${{ secrets.QUAY_NAMESPACE }} + # quay_custom_namespace: ${{ inputs.quay_custom_namespace }} + # quay_img_exp: ${{ inputs.quay_img_exp }} + # build_timeout: ${{ inputs.build_timeout }} + # archetype: ${{ inputs.archetype }} + # req_check_only: ${{ inputs.multi_arch }} + + # - name: Install qemu dependency + # run: | + # sudo apt-get update + # sudo apt-get install -y qemu-user-static + + # - name: Log in to quay.io for multi-arch + # if: ${{ inputs.multi_arch }} + # uses: redhat-actions/podman-login@v1 + # with: + # registry: quay.io + # username: ${{ secrets.QUAY_USERNAME }} + # password: ${{ secrets.QUAY_PASSWORD }} + + act-build-release: + name: Build ${{ github.ref_name }} from ${{ github.event_name }} + if: github.event_name == 'release' && inputs.multi_arch == true + runs-on: ubuntu-latest + steps: + - name: Initialize ACT + uses: ./.github/actions/act_init.yaml with: image_name: ${{ inputs.image_name }} image_tag: ${{ inputs.image_tag }} @@ -75,17 +110,6 @@ jobs: build_timeout: ${{ inputs.build_timeout }} archetype: ${{ inputs.archetype }} req_check_only: ${{ inputs.multi_arch }} - - - name: Install qemu dependency - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - - name: Log in to quay.io for multi-arch - if: ${{ inputs.multi_arch }} - uses: redhat-actions/podman-login@v1 - with: - registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} @@ -113,6 +137,30 @@ jobs: - name: Print release image url if: github.event_name == 'release' && inputs.multi_arch == true run: echo "Image pushed to ${{ steps.push-release-to-quay.outputs.registry-paths }}" + + act-build-dev: + name: Build ${{ github.ref_name }} from ${{ github.event_name }} + if: github.event_name == 'release' && inputs.multi_arch == true + runs-on: ubuntu-latest + steps: + - name: Initialize ACT + uses: ./.github/actions/act_init.yaml + with: + image_name: ${{ inputs.image_name }} + image_tag: ${{ inputs.image_tag }} + github_username: ${{ inputs.github_username }} + github_password: ${{ secrets.GITHUB_TOKEN }} + github_namespace: ${{ inputs.github_namespace }} + quay_username: ${{ secrets.QUAY_USERNAME }} + quay_password: ${{ secrets.QUAY_PASSWORD }} + quay_namespace: ${{ secrets.QUAY_NAMESPACE }} + quay_custom_namespace: ${{ inputs.quay_custom_namespace }} + quay_img_exp: ${{ inputs.quay_img_exp }} + build_timeout: ${{ inputs.build_timeout }} + archetype: ${{ inputs.archetype }} + req_check_only: ${{ inputs.multi_arch }} + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} - name: Build multi-arch image for dev id: build-multi-arch-dev