Browse Source

Merge #514

514: Publish docker image improvements r=itchymax a=itchymax

Note: the only thing we need from the checkout is the dockerfile. The rest does not matter. 
Nevertheless, when manually releasing docker images by release tag, we should check out that particular release tag to ensure we are using the correct dockerfile

Co-authored-by: itchymax <itchymax@itchysats.network>
new-http-api
bors[bot] 3 years ago
committed by GitHub
parent
commit
41aad18eff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      .github/workflows/build-release-binary.yml
  2. 2
      .github/workflows/create-release.yml
  3. 8
      .github/workflows/draft-new-release.yml
  4. 2
      .github/workflows/preview-release.yml
  5. 42
      .github/workflows/release-docker.yml

41
.github/workflows/build-release-binary.yml

@ -56,7 +56,7 @@ jobs:
uses: actions/checkout@v2.4.0 uses: actions/checkout@v2.4.0
with: with:
ref: ${{ github.event.release.target_commitish }} ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }} token: ${{ secrets.ITCHY_GITHUB_TOKEN }}
- name: Install toolchain from `rust-toolchain.toml` - name: Install toolchain from `rust-toolchain.toml`
run: rustup show run: rustup show
@ -139,7 +139,7 @@ jobs:
- name: Upload archive - name: Upload archive
uses: actions/upload-release-asset@v1.0.2 uses: actions/upload-release-asset@v1.0.2
env: env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.create-archive-name.outputs.archive }} asset_path: ./${{ steps.create-archive-name.outputs.archive }}
@ -154,8 +154,13 @@ jobs:
permissions: permissions:
contents: read contents: read
packages: write packages: write
strategy:
matrix:
include:
- bin: maker
- bin: taker
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}
steps: steps:
- name: Checkout tagged commit - name: Checkout tagged commit
uses: actions/checkout@v2.4.0 uses: actions/checkout@v2.4.0
@ -176,7 +181,7 @@ jobs:
- name: Download release from github - name: Download release from github
run: | run: |
gh release download ${{ github.event.release.tag_name }} -p '*Linux_x86_64*' -p '*aarch64*' -p '*armv7*' gh release download ${{ github.event.release.tag_name }} -p '${{matrix.bin}}*Linux_x86_64*' -p '${{matrix.bin}}*aarch64*' -p '${{matrix.bin}}*armv7*'
- name: Unpack archives - name: Unpack archives
run: | run: |
@ -186,32 +191,24 @@ jobs:
# when building the image. This variable is either # when building the image. This variable is either
# `linux/amd64/`, `linux/arm64/` or `linux/arm/v7`. Hence we need to extract into subfolders. # `linux/amd64/`, `linux/arm64/` or `linux/arm/v7`. Hence we need to extract into subfolders.
7z x maker_${{ github.event.release.tag_name }}_Linux_aarch64.tar -olinux/arm64/ 7z x ${{matrix.bin}}_${{ github.event.release.tag_name }}_Linux_aarch64.tar -olinux/arm64/
7z x taker_${{ github.event.release.tag_name }}_Linux_aarch64.tar -olinux/arm64/
7z x maker_${{ github.event.release.tag_name }}_Linux_x86_64.tar -olinux/amd64/ 7z x ${{matrix.bin}}_${{ github.event.release.tag_name }}_Linux_x86_64.tar -olinux/amd64/
7z x taker_${{ github.event.release.tag_name }}_Linux_x86_64.tar -olinux/amd64/
7z x maker_${{ github.event.release.tag_name }}_Linux_armv7.tar -olinux/arm/v7 7z x ${{matrix.bin}}_${{ github.event.release.tag_name }}_Linux_armv7.tar -olinux/arm/v7
7z x taker_${{ github.event.release.tag_name }}_Linux_armv7.tar -olinux/arm/v7
- name: Build maker docker image - name: Build docker image for ${{matrix.bin}}
run: | run: |
docker buildx build \ VERSION=${{ github.event.release.tag_name }}
--push \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \
--tag ghcr.io/${{ github.repository }}/maker:${{ github.event.release.tag_name }} \
--build-arg BINARY_PATH=maker \
.
if [ "$VERSION" = "preview" ]; then
VERSION=latest
fi
- name: Build taker docker image
run: |
docker buildx build \ docker buildx build \
--push \ --push \
--platform linux/amd64,linux/arm64,linux/arm/v7 \ --platform linux/amd64,linux/arm64,linux/arm/v7 \
--label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \ --label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \
--tag ghcr.io/${{ github.repository }}/taker:${{ github.event.release.tag_name }} \ --tag ghcr.io/${{ github.repository }}/${{matrix.bin}}:${VERSION} \
--build-arg BINARY_PATH=taker \ --build-arg BINARY_PATH=${{matrix.bin}} \
. .

2
.github/workflows/create-release.yml

@ -25,7 +25,7 @@ jobs:
- name: Create release - name: Create release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}
with: with:
tag_name: ${{ steps.extract-version.outputs.version }} tag_name: ${{ steps.extract-version.outputs.version }}
release_name: ${{ steps.extract-version.outputs.version }} release_name: ${{ steps.extract-version.outputs.version }}

8
.github/workflows/draft-new-release.yml

@ -19,15 +19,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v2.4.0 - uses: actions/checkout@v2.4.0
with: with:
token: ${{ secrets.BOTTY_GITHUB_TOKEN }} token: ${{ secrets.ITCHY_GITHUB_TOKEN }}
- name: Create release branch - name: Create release branch
run: git checkout -b ${{ env.RELEASE_BRANCH }} run: git checkout -b ${{ env.RELEASE_BRANCH }}
- name: Initialize mandatory git config - name: Initialize mandatory git config
run: | run: |
git config user.name "${{ secrets.BOTTY_NAME }}" git config user.name "${{ secrets.ITCHY_NAME }}"
git config user.email ${{ secrets.BOTTY_EMAIL }} git config user.email ${{ secrets.ITCHY_EMAIL }}
- name: Bump version in Cargo.toml - name: Bump version in Cargo.toml
uses: thomaseizinger/set-crate-version@1.0.0 uses: thomaseizinger/set-crate-version@1.0.0
@ -66,4 +66,4 @@ jobs:
env: env:
# Using a bot account is important to trigger subsequent workflows. # Using a bot account is important to trigger subsequent workflows.
# See https://devopsdirective.com/posts/2020/07/stupid-github-actions/#2----recursive-action. # See https://devopsdirective.com/posts/2020/07/stupid-github-actions/#2----recursive-action.
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}

2
.github/workflows/preview-release.yml

@ -10,7 +10,7 @@ jobs:
name: Create preview release name: Create preview release
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}
steps: steps:
- uses: actions/checkout@v2.4.0 - uses: actions/checkout@v2.4.0

42
.github/workflows/release-docker.yml

@ -3,7 +3,7 @@ name: "Release docker images from release"
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
realease_tag: release_tag:
description: 'The release tag to build containers for (preview or x.y.z)' description: 'The release tag to build containers for (preview or x.y.z)'
required: true required: true
@ -15,12 +15,16 @@ jobs:
permissions: permissions:
contents: read contents: read
packages: write packages: write
strategy:
matrix:
bin: [maker,taker]
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ITCHY_GITHUB_TOKEN }}
steps: steps:
- name: Checkout tagged commit - name: Checkout tagged commit
uses: actions/checkout@v2.4.0 uses: actions/checkout@v2.4.0
# TODO: checkout the tag and not master with:
ref: ${{ github.event.inputs.release_tag }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
@ -36,7 +40,7 @@ jobs:
- name: Download release - name: Download release
run: | run: |
gh release download ${{ github.event.inputs.realease_tag }} -p '*Linux_x86_64*' -p '*aarch64*' -p '*armv7*' gh release download ${{ github.event.inputs.release_tag }} -p '${{matrix.bin}}*Linux_x86_64*' -p '${{matrix.bin}}*aarch64*' -p '${{matrix.bin}}*armv7*'
- name: Unpack archives - name: Unpack archives
run: | run: |
@ -46,34 +50,24 @@ jobs:
# when building the image. This variable is either # when building the image. This variable is either
# `linux/amd64/`, `linux/arm64/` or `linux/arm/v7`. Hence we need to extract into subfolders. # `linux/amd64/`, `linux/arm64/` or `linux/arm/v7`. Hence we need to extract into subfolders.
7z x maker_${{ github.event.inputs.realease_tag }}_Linux_aarch64.tar -olinux/arm64/ 7z x ${{matrix.bin}}_${{ github.event.inputs.release_tag }}_Linux_aarch64.tar -olinux/arm64/
7z x taker_${{ github.event.inputs.realease_tag }}_Linux_aarch64.tar -olinux/arm64/
7z x maker_${{ github.event.inputs.realease_tag }}_Linux_x86_64.tar -olinux/amd64/ 7z x ${{matrix.bin}}_${{ github.event.inputs.release_tag }}_Linux_x86_64.tar -olinux/amd64/
7z x taker_${{ github.event.inputs.realease_tag }}_Linux_x86_64.tar -olinux/amd64/
7z x maker_${{ github.event.inputs.realease_tag }}_Linux_armv7.tar -olinux/arm/v7 7z x ${{matrix.bin}}_${{ github.event.inputs.release_tag }}_Linux_armv7.tar -olinux/arm/v7
7z x taker_${{ github.event.inputs.realease_tag }}_Linux_armv7.tar -olinux/arm/v7
- name: Build maker docker image - name: Build docker image for ${{matrix.bin}}
run: | run: |
docker buildx build \ VERSION=${{ github.event.inputs.release_tag }}
--push \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \
--tag ghcr.io/${{ github.repository }}/maker:${{ github.event.inputs.realease_tag }} \
--build-arg BINARY_PATH=maker \
.
if [ "$VERSION" = "preview" ]; then
VERSION=latest
fi
- name: Build taker docker image
run: |
docker buildx build \ docker buildx build \
--push \ --push \
--platform linux/amd64,linux/arm64,linux/arm/v7 \ --platform linux/amd64,linux/arm64,linux/arm/v7 \
--label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \ --label "org.opencontainers.image.source https://github.com/${{ github.repository }}" \
--tag ghcr.io/${{ github.repository }}/taker:${{ github.event.inputs.realease_tag }} \ --tag ghcr.io/${{ github.repository }}/${{matrix.bin}}:${VERSION} \
--build-arg BINARY_PATH=taker \ --build-arg BINARY_PATH=${{matrix.bin}} \
. .

Loading…
Cancel
Save