2020-07-03 00:31:29 +08:00
|
|
|
name: Update, build and push Docker images
|
2020-05-13 14:21:13 +08:00
|
|
|
|
|
|
|
on:
|
2020-07-03 00:31:29 +08:00
|
|
|
schedule:
|
|
|
|
- cron: "12 */4 * * *"
|
2020-05-13 14:21:13 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-11-16 13:51:43 +08:00
|
|
|
workflow_dispatch:
|
2020-05-13 14:21:13 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: hairyhenderson/dockerfiles-builder:latest
|
|
|
|
env:
|
|
|
|
BASHBREW_LIBRARY: ./library
|
|
|
|
BASHBREW_NAMESPACE: productionwentdown
|
2021-11-16 14:50:16 +08:00
|
|
|
BASHBREW_ARCH_NAMESPACES: amd64=productionwentdown
|
2020-07-03 00:31:29 +08:00
|
|
|
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
|
2020-05-13 14:21:13 +08:00
|
|
|
steps:
|
|
|
|
|
2022-07-09 19:23:14 +08:00
|
|
|
- uses: actions/checkout@v3
|
2020-05-13 14:21:13 +08:00
|
|
|
|
2020-07-03 00:31:29 +08:00
|
|
|
- name: Set Git user
|
|
|
|
run: |
|
2023-02-09 09:11:40 +08:00
|
|
|
git config --global user.email "action@github.com"
|
|
|
|
git config --global user.name "GitHub Action"
|
2023-02-09 09:19:55 +08:00
|
|
|
git config --global --add safe.directory $(pwd)
|
2020-07-03 00:31:29 +08:00
|
|
|
|
2020-07-03 00:34:56 +08:00
|
|
|
- name: Install Go
|
|
|
|
run: |
|
|
|
|
apk add --no-cache go
|
|
|
|
|
2020-07-03 00:31:29 +08:00
|
|
|
- name: Regenerate Dockerfiles
|
|
|
|
run: |
|
2021-11-16 14:22:55 +08:00
|
|
|
go run update.go -dockerfiles -readme
|
|
|
|
|
2020-07-03 00:31:29 +08:00
|
|
|
- name: Commit and push changes
|
2020-07-03 00:42:23 +08:00
|
|
|
id: commit-dockerfiles
|
2020-07-03 00:31:29 +08:00
|
|
|
run: |
|
2021-11-16 15:07:56 +08:00
|
|
|
git add */*/Dockerfile README.md
|
2020-07-03 00:31:29 +08:00
|
|
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
|
|
|
git commit -m "Bump Caddy version" -a
|
|
|
|
git push
|
|
|
|
echo "::set-output name=bumped::yes"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Regenerate Bashbrew manifests
|
2021-05-12 08:37:22 +08:00
|
|
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
|
2020-07-03 00:31:29 +08:00
|
|
|
run: |
|
|
|
|
go run update.go -manifest -commit $(git log -1 --format='format:%H' HEAD)
|
|
|
|
|
2020-07-03 01:01:19 +08:00
|
|
|
- name: Commit and push changes
|
2021-05-12 08:37:22 +08:00
|
|
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
|
2021-05-11 23:14:57 +08:00
|
|
|
id: commit-bashbrew
|
2020-07-03 01:01:19 +08:00
|
|
|
run: |
|
|
|
|
git add library/caddy
|
|
|
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
|
|
|
git commit -m "Bump Caddy version" -a
|
|
|
|
git push
|
2021-05-11 23:11:12 +08:00
|
|
|
echo "::set-output name=bumped::yes"
|
2020-07-03 01:01:19 +08:00
|
|
|
fi
|
|
|
|
|
2020-07-03 01:05:56 +08:00
|
|
|
- name: Build images on Linux
|
2021-05-11 23:14:57 +08:00
|
|
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
|
2020-07-03 00:31:29 +08:00
|
|
|
run: |
|
|
|
|
bashbrew build --pull always caddy
|
2020-05-13 14:21:13 +08:00
|
|
|
|
2020-07-03 01:05:56 +08:00
|
|
|
- name: Push images
|
2021-05-11 23:14:57 +08:00
|
|
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
|
2020-05-13 14:21:13 +08:00
|
|
|
run: |
|
2024-05-03 09:40:30 +08:00
|
|
|
wget https://github.com/estesp/manifest-tool/releases/download/v2.1.6/binaries-manifest-tool-2.1.6.tar.gz -O manifest-tool.tar.gz
|
|
|
|
tar -xf manifest-tool.tar.gz
|
|
|
|
mv manifest-tool-linux-amd64 /usr/local/bin/manifest-tool
|
2020-07-03 01:32:05 +08:00
|
|
|
chmod +x /usr/local/bin/manifest-tool
|
2020-05-13 14:21:13 +08:00
|
|
|
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
|
|
|
bashbrew push caddy
|
2021-05-12 08:52:23 +08:00
|
|
|
bashbrew put-shared --single-arch caddy
|
2021-11-16 15:07:56 +08:00
|
|
|
|
2021-11-16 15:13:27 +08:00
|
|
|
#- name: Update Docker Hub Description
|
|
|
|
# uses: peter-evans/dockerhub-description@v2
|
|
|
|
# with:
|
|
|
|
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
# repository: productionwentdown/caddy
|