2020-07-17 10:24:33 -04:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 12 * * *"
|
|
|
|
push:
|
2020-07-17 12:21:44 -04:00
|
|
|
paths-ignore:
|
|
|
|
- "*.md"
|
|
|
|
- "*.txt"
|
|
|
|
- "*.png"
|
2020-07-17 10:24:33 -04:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_NAME: atmoz/sftp
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0 # for proper signature verification
|
|
|
|
submodules: true # for shunit2
|
|
|
|
|
2020-07-19 16:13:03 -04:00
|
|
|
- name: Run ShellCheck
|
|
|
|
uses: ludeeus/action-shellcheck@master
|
|
|
|
with:
|
2021-12-18 15:57:39 -05:00
|
|
|
ignore_paths: tests/shunit2
|
2020-07-19 16:13:03 -04:00
|
|
|
|
2020-07-17 10:24:33 -04:00
|
|
|
- name: Build debian image
|
|
|
|
run: |
|
|
|
|
docker build . \
|
|
|
|
--pull=true \
|
|
|
|
--file=Dockerfile \
|
|
|
|
--tag="$IMAGE_NAME:latest" \
|
2020-07-18 09:39:06 -04:00
|
|
|
--tag="$IMAGE_NAME:debian" \
|
2020-07-17 10:24:33 -04:00
|
|
|
--label="org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
|
|
|
|
--label="org.opencontainers.image.revision=$GITHUB_SHA" \
|
|
|
|
--label="org.opencontainers.image.created=$(date --rfc-3339=seconds)"
|
|
|
|
|
|
|
|
- name: Test debian image
|
|
|
|
run: tests/run $IMAGE_NAME:debian
|
|
|
|
|
|
|
|
- name: Build alpine image
|
|
|
|
run: |
|
|
|
|
docker build . \
|
|
|
|
--pull=true \
|
|
|
|
--file=Dockerfile-alpine \
|
|
|
|
--tag="$IMAGE_NAME:alpine" \
|
|
|
|
--label="org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
|
|
|
|
--label="org.opencontainers.image.revision=$GITHUB_SHA" \
|
|
|
|
--label="org.opencontainers.image.created=$(date --rfc-3339=seconds)"
|
|
|
|
|
|
|
|
- name: Test alpine image
|
|
|
|
run: tests/run $IMAGE_NAME:alpine
|
|
|
|
|
|
|
|
- name: Verify signature
|
2020-07-19 16:12:23 -04:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2020-07-18 09:44:46 -04:00
|
|
|
uses: atmoz/git-verify-ref@master
|
|
|
|
with:
|
2020-07-19 16:11:43 -04:00
|
|
|
import-github-users: atmoz
|
2020-07-17 10:24:33 -04:00
|
|
|
|
|
|
|
- name: Push images to Docker Hub registry
|
2020-07-19 16:12:23 -04:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2020-07-17 10:24:33 -04:00
|
|
|
run: |
|
|
|
|
echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login \
|
|
|
|
-u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
|
|
|
|
2021-12-18 15:38:05 -05:00
|
|
|
docker push --all-tags $IMAGE_NAME
|
2020-07-19 17:02:07 -04:00
|
|
|
docker logout
|
2020-07-17 10:24:33 -04:00
|
|
|
|
|
|
|
- name: Push images to GitHub registry
|
2020-07-19 16:12:23 -04:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2020-07-17 10:24:33 -04:00
|
|
|
run: |
|
|
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com \
|
|
|
|
-u ${{ github.actor }} --password-stdin
|
|
|
|
|
|
|
|
TAG_DEBIAN=docker.pkg.github.com/$GITHUB_REPOSITORY/debian
|
|
|
|
TAG_ALPINE=docker.pkg.github.com/$GITHUB_REPOSITORY/alpine
|
|
|
|
docker tag $IMAGE_NAME:debian $TAG_DEBIAN
|
|
|
|
docker tag $IMAGE_NAME:alpine $TAG_ALPINE
|
|
|
|
docker push $TAG_DEBIAN
|
|
|
|
docker push $TAG_ALPINE
|
2020-07-19 17:02:07 -04:00
|
|
|
docker logout docker.pkg.github.com
|
2020-07-17 10:24:33 -04:00
|
|
|
|