add multiarch image support #106
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: Java CI with Maven | |
| on: | |
| push: | |
| branches: | |
| - beta | |
| - master | |
| - build2.2 | |
| - betamultiarch | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up JDK 1.8 | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 1.8 | |
| - name: Cache Maven packages | |
| uses: actions/cache@v2 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/build.sh') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build with Maven | |
| run: chmod +x ./build.sh && ./build.sh | |
| - name: Get branch name | |
| run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
| id: get_branch | |
| - run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Get version tag | |
| run: echo "##[set-output name=version;]$(echo `git ls-remote https://${{ secrets.my_pat }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ steps.get_branch.outputs.branch }} | awk '{ print $1}' | cut -c1-7`)abcd" | |
| id: get_version | |
| # QEMU is required to build arm from a non-arm build machine | |
| - name: Set up QEMU | |
| id: qemu | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
| platforms: arm64 | |
| - name: Set up Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to GitHub Registry | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: $GITHUB_ACTOR | |
| password: ${{ secrets.my_pat }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v2 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:latest | |
| ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:${{ steps.get_version.outputs.version }} | |
| - name: Check Image Manifest | |
| run: docker buildx imagetools inspect --raw ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ steps.get_branch.outputs.branch }}:${{ steps.get_version.outputs.version }} | |
| # - name: Check out into atlan repo | |
| # uses: actions/checkout@v2 | |
| # with: | |
| # ref: ${{ steps.get_branch.outputs.branch }} | |
| # repository: atlanhq/atlan | |
| # token: ${{ secrets.my_pat }} | |
| # - name: Add Changelog | |
| # run: | | |
| # mkdir -p gitlog | |
| # echo "- ${{ github.event.head_commit.message }}">>gitlog/${{ github.event.repository.name }}.txt | |
| # chmod +x ./scripts/create_changelog.sh | |
| # ./scripts/create_changelog.sh | |
| # - name: Commit changes | |
| # uses: EndBug/add-and-commit@v7 | |
| # with: | |
| # branch: ${{ steps.get_branch.outputs.branch }} | |
| # author_name: atlan-ci | |
| # author_email: [email protected] | |
| # message: '${{ github.event.repository.name }}' | |
| # default_author: user_info | |
| # push: origin ${{ steps.get_branch.outputs.branch }} | |