build(ci): test the image compilation
This commit is contained in:
parent
a7b7a15a2f
commit
66f9bd50be
2 changed files with 66 additions and 1 deletions
|
|
@ -11,7 +11,8 @@
|
|||
"settings": {},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-azuretools.vscode-docker"
|
||||
"ms-azuretools.vscode-docker",
|
||||
"github.vscode-pull-request-github"
|
||||
],
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
|
|
|
|||
64
.github/workflows/build.yml
vendored
Normal file
64
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
name: Build Container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
is_new: ${{ steps.check_ver.outputs.is_new }}
|
||||
version: ${{ steps.check_ver.outputs.version }}
|
||||
steps:
|
||||
- name: Check version
|
||||
id: check_ver
|
||||
run: |
|
||||
get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1)
|
||||
OLD_VER=$(get_ver ${GHCO_URL})
|
||||
NEW_VER=$(get_ver ${ALPINE_PKG_URL})
|
||||
if [ "$NEW_VER" != "$OLD_VER" ]; then
|
||||
echo "::set-output name=is_new::true"
|
||||
else
|
||||
echo "::set-output name=is_new::false"
|
||||
fi
|
||||
echo "::set-output name=version::${NEW_VER}"
|
||||
env:
|
||||
ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_6
|
||||
4/qbittorrent-nox
|
||||
GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: ${{ !needs.check.outputs.is_new }}
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build . \
|
||||
--build-arg "VERSION=${{ needs.check.outputs.version }}" \
|
||||
--label "BUILD_ID=${GITHUB_RUN_ID}" \
|
||||
--label "BUILD_SERVER=${GITHUB_SERVER_URL}" \
|
||||
--label "OS=${RUNNER_OS}" \
|
||||
--tag qbittorrent
|
||||
|
||||
- name: Save status
|
||||
run: docker images > ${{ github.workspace }}/images.txt
|
||||
|
||||
- name: Update status
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: images
|
||||
path: ${{ github.workspace }}/images.txt
|
||||
Loading…
Add table
Reference in a new issue