|
@@ -17,8 +17,6 @@ concurrency:
|
|
|
env:
|
|
env:
|
|
|
# Use docker.io for Docker Hub if empty
|
|
# Use docker.io for Docker Hub if empty
|
|
|
REGISTRY: ghcr.io
|
|
REGISTRY: ghcr.io
|
|
|
- # github.repository as <account>/<repo>
|
|
|
|
|
- IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
build-and-publish-opencost:
|
|
build-and-publish-opencost:
|
|
@@ -63,23 +61,11 @@ jobs:
|
|
|
uses: actions/checkout@v4
|
|
uses: actions/checkout@v4
|
|
|
with:
|
|
with:
|
|
|
ref: '${{ steps.branch.outputs.BRANCH_NAME }}'
|
|
ref: '${{ steps.branch.outputs.BRANCH_NAME }}'
|
|
|
- path: ./opencost
|
|
|
|
|
|
|
|
|
|
- name: Set SHA
|
|
- name: Set SHA
|
|
|
id: sha
|
|
id: sha
|
|
|
run: |
|
|
run: |
|
|
|
- pushd ./opencost
|
|
|
|
|
echo "OC_SHORTHASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
echo "OC_SHORTHASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
|
- popd
|
|
|
|
|
-
|
|
|
|
|
- # Login against a Docker registry except on PR
|
|
|
|
|
- # https://github.com/docker/login-action
|
|
|
|
|
- - name: Log into registry ${{ env.REGISTRY }}
|
|
|
|
|
- uses: docker/login-action@v3
|
|
|
|
|
- with:
|
|
|
|
|
- registry: ${{ env.REGISTRY }}
|
|
|
|
|
- username: ${{ github.actor }}
|
|
|
|
|
- password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Set OpenCost Image Tags
|
|
- name: Set OpenCost Image Tags
|
|
|
id: tags
|
|
id: tags
|
|
@@ -88,37 +74,26 @@ jobs:
|
|
|
echo "IMAGE_TAG_LATEST=ghcr.io/${{ github.repository_owner }}/opencost:latest" >> $GITHUB_OUTPUT
|
|
echo "IMAGE_TAG_LATEST=ghcr.io/${{ github.repository_owner }}/opencost:latest" >> $GITHUB_OUTPUT
|
|
|
echo "IMAGE_TAG_VERSION=ghcr.io/${{ github.repository_owner }}/opencost:${{ steps.version_number.outputs.RELEASE_VERSION }}" >> $GITHUB_OUTPUT
|
|
echo "IMAGE_TAG_VERSION=ghcr.io/${{ github.repository_owner }}/opencost:${{ steps.version_number.outputs.RELEASE_VERSION }}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- - name: Set up Docker Buildx
|
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
+ - name: Build and publish container
|
|
|
|
|
+ uses: ./.github/actions/build-container
|
|
|
with:
|
|
with:
|
|
|
- buildkitd-flags: --debug
|
|
|
|
|
|
|
+ actor: ${{ github.actor }}
|
|
|
|
|
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
+ image_tag: ${{ steps.tags.outputs.IMAGE_TAG }}
|
|
|
|
|
+ release_version: ${{ steps.version_number.outputs.RELEASE_VERSION }}
|
|
|
|
|
|
|
|
- - name: Install Go
|
|
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
|
|
|
+ - name: Log into registry ${{ env.REGISTRY }}
|
|
|
|
|
+ uses: docker/login-action@v3
|
|
|
with:
|
|
with:
|
|
|
- go-version: 'stable'
|
|
|
|
|
-
|
|
|
|
|
- - name: Set up just
|
|
|
|
|
- uses: extractions/setup-just@v2
|
|
|
|
|
|
|
+ registry: ${{ env.REGISTRY }}
|
|
|
|
|
+ username: ${{ github.actor }}
|
|
|
|
|
+ password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Install crane
|
|
- name: Install crane
|
|
|
uses: imjasonh/setup-crane@v0.4
|
|
uses: imjasonh/setup-crane@v0.4
|
|
|
|
|
|
|
|
- ## Install manifest-tool, which is required to combine multi-arch images
|
|
|
|
|
- ## https://github.com/estesp/manifest-tool
|
|
|
|
|
- - name: Install manifest-tool
|
|
|
|
|
- run: |
|
|
|
|
|
- mkdir -p manifest-tool
|
|
|
|
|
- pushd manifest-tool
|
|
|
|
|
- wget -q https://github.com/estesp/manifest-tool/releases/download/v2.0.8/binaries-manifest-tool-2.0.8.tar.gz
|
|
|
|
|
- tar -xzf binaries-manifest-tool-2.0.8.tar.gz
|
|
|
|
|
- cp manifest-tool-linux-amd64 manifest-tool
|
|
|
|
|
- echo "$(pwd)" >> $GITHUB_PATH
|
|
|
|
|
-
|
|
|
|
|
- - name: Build and push (multiarch) OpenCost
|
|
|
|
|
- working-directory: ./opencost
|
|
|
|
|
|
|
+ - name: Copy tags
|
|
|
run: |
|
|
run: |
|
|
|
- just build '${{ steps.tags.outputs.IMAGE_TAG }}' '${{ steps.version_number.outputs.RELEASE_VERSION }}'
|
|
|
|
|
crane copy '${{ steps.tags.outputs.IMAGE_TAG }}' '${{ steps.tags.outputs.IMAGE_TAG_LATEST }}'
|
|
crane copy '${{ steps.tags.outputs.IMAGE_TAG }}' '${{ steps.tags.outputs.IMAGE_TAG_LATEST }}'
|
|
|
crane copy '${{ steps.tags.outputs.IMAGE_TAG }}' '${{ steps.tags.outputs.IMAGE_TAG_VERSION }}'
|
|
crane copy '${{ steps.tags.outputs.IMAGE_TAG }}' '${{ steps.tags.outputs.IMAGE_TAG_VERSION }}'
|
|
|
|
|
|