|
| 1 | +name: Publish container |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + workflow_dispatch: |
| 7 | +jobs: |
| 8 | + publish-singularity-container: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + env: |
| 11 | + SINGULARITY: 1 |
| 12 | + steps: |
| 13 | + - name: Clone Github Repo Action |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Setup apptainer |
| 17 | + uses: eWaterCycle/[email protected] |
| 18 | + with: |
| 19 | + apptainer-version: 1.4.0 |
| 20 | + |
| 21 | + - name: Get container tag |
| 22 | + run: | |
| 23 | + TAG=$(cat bin/.container-tag) |
| 24 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 25 | +
|
| 26 | + - name: Get container from cache |
| 27 | + id: cache-sif |
| 28 | + uses: actions/cache@v4 |
| 29 | + with: |
| 30 | + path: .singularity/image.sif |
| 31 | + key: ${{ hashFiles('container.def', 'bin/.container-tag') }} |
| 32 | + |
| 33 | + - name: Get gems and node files from cache |
| 34 | + id: cache-bundle-npm |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + .home/.gems |
| 39 | + node_modules |
| 40 | + key: ${{ hashFiles('Gemfile.lock') }}-${{ hashFiles('package-lock.json') }} |
| 41 | + |
| 42 | + - if: ${{ steps.cache-sif.outputs.cache-hit != 'true' }} |
| 43 | + name: Build container |
| 44 | + run: ./bin/build_container |
| 45 | + |
| 46 | + - name: Upload singularity container |
| 47 | + run: | |
| 48 | + apptainer registry login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} oras://docker.io |
| 49 | + apptainer push .singularity/image.sif oras://docker.io/riscvintl/spec-generator:${{ env.TAG }} |
| 50 | +
|
| 51 | + publish-docker-container: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + env: |
| 54 | + DOCKER: 1 |
| 55 | + steps: |
| 56 | + - name: Clone Github Repo Action |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Get container tag |
| 60 | + run: | |
| 61 | + TAG=$(cat bin/.container-tag) |
| 62 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 63 | +
|
| 64 | + - name: Login to Docker Hub |
| 65 | + uses: docker/login-action@v3 |
| 66 | + with: |
| 67 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 68 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Set up QEMU |
| 71 | + uses: docker/setup-qemu-action@v3 |
| 72 | + |
| 73 | + - name: Set up Docker Buildx |
| 74 | + uses: docker/setup-buildx-action@v3 |
| 75 | + |
| 76 | + - name: Build and push |
| 77 | + uses: docker/build-push-action@v6 |
| 78 | + with: |
| 79 | + push: true |
| 80 | + file: ./.devcontainer/Dockerfile |
| 81 | + platforms: linux/amd64,linux/arm64 |
| 82 | + tags: riscvintl/udb:${{ env.TAG }} |
0 commit comments