Refine Docker image tag logic in manual installer workflow #349
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: openstudio-docker | |
| on: [push, pull_request] | |
| # example of how to restrict to one branch and push event | |
| #on: | |
| # push: | |
| # branches: | |
| # - test_branch | |
| concurrency: | |
| group: openstudio-docker-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| USE_TESTING_TIMEOUTS: "true" | |
| OPENSTUDIO_VERSION: 3.11.0 | |
| OPENSTUDIO_SHA: dee62bf9dd | |
| OPENSTUDIO_VERSION_EXT: "-rc1" | |
| OPENSTUDIO_DOWNLOAD_URL: "https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-24.04-x86_64.deb" | |
| permissions: | |
| contents: read | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12.x' | |
| - name: test and build | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| docker build -t openstudio:latest \ | |
| --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \ | |
| --build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \ | |
| --build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT . | |
| docker run openstudio:latest openstudio openstudio_version | |
| docker run openstudio:latest /usr/local/openstudio-$OPENSTUDIO_VERSION/Radiance/bin/rtrace -version | |
| docker run -v "$(pwd)":/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb | |
| docker run -v "$(pwd)/test":/var/simdata/openstudio openstudio:latest ./test_gemfile.sh | |
| - name: deploy docker | |
| if: ${{ success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name') }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./deploy_docker.sh | |
| env: | |
| DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | |
| DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
| apptainer: | |
| runs-on: ubuntu-24.04 | |
| needs: docker | |
| if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12.x' | |
| - name: install apptainer | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sudo add-apt-repository -y ppa:apptainer/ppa | |
| sudo apt update | |
| sudo apt install -y apptainer | |
| - name: build apptainer | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| apptainer build \ | |
| OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \ | |
| docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: apptainer-image | |
| path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
| role-to-assume: arn:aws:iam::471211731895:role/OpenStudioGitHubActionsRole | |
| role-session-name: GitHubActions | |
| - name: Upload artifacts to AWS S3 | |
| uses: usualdesigner/s3-artifact-upload@main | |
| with: | |
| bucket-name: openstudio-builds | |
| prefix: ${{ env.OPENSTUDIO_VERSION }} | |
| file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif |