Skip to content

Commit

Permalink
update bulding workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Dec 19, 2024
1 parent 5ce824f commit ccfe1bf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 54 deletions.
74 changes: 28 additions & 46 deletions .github/workflows/build_push_stata_gen3_licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,59 +11,41 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
- uses: actions/checkout@v4
- uses: prewk/s3-cp-action@v2
with:
root-reserve-mb: 30000
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
- uses: actions/checkout@v2
- uses: prewk/[email protected]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://ctds-stata/StataNow18Linux64.tar.gz'
DEST: './jupyter-pystata-gen3-licensed/resources/'
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: 's3://ctds-stata/StataNow18Linux64.tar.gz'
dest: './jupyter-pystata-gen3-licensed/resources/'

- name: Extract branch name
shell: bash
run: echo "branch=$(echo $(echo ${GITHUB_REF#refs/*/} | tr / _))" >> $GITHUB_OUTPUT
id: extract_branch

- name: Determine image to build
id: parse_image
shell: python
run: |
import os
build_target = "jupyter-pystata-licensed"
print(f"Will trigger build for: {build_target}")
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'build_target={build_target}', file=fh)
echo "IMAGE_TAG=$(echo ${GITHUB_REF#refs/*/} | tr / _)"
echo "IMAGE_TAG=$(echo ${GITHUB_REF#refs/*/} | tr / _)" >> $GITHUB_ENV
- if: ${{ steps.parse_image.outputs.build_target }}
name: Sanitize image name
id: sanitize_name
run: |
IMAGE_NAME=$( sed 's/[^[:alnum:]]/_/g' <<< ${{ steps.parse_image.outputs.build_target }} );
echo "image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT
- name: Login to Quay.io
id: login
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
image: jupyter-pystata-gen3-licensed
tags: ${{ steps.extract_branch.outputs.branch }}
dockerfiles: ./jupyter-pystata-gen3-licensed/Dockerfile
images: |
quay.io/cdis/jupyter-pystata-gen3-licensed:${{ env.IMAGE_TAG }}
- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
- name: Build and Push Image
uses: docker/build-push-action@v6
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/cdis
username: ${{ secrets.QUAY_SERVICE_ACCOUNT_USER }}
password: ${{ secrets.QUAY_SERVICE_ACCOUNT_PASSWORD }}
context: ./jupyter-pystata-gen3-licensed
file: "./jupyter-pystata-gen3-licensed/Dockerfile"
push: true
tags: |
quay.io/cdis/jupyter-pystata-gen3-licensed:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 0 additions & 8 deletions .github/workflows/build_push_stata_user_licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# root-reserve-mb: 30000
# swap-size-mb: 1024
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
- uses: actions/checkout@v4
- uses: prewk/s3-cp-action@v2
with:
Expand Down

0 comments on commit ccfe1bf

Please sign in to comment.