0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-17 12:51:33 -05:00
atmoz-sftp/.github/workflows/build.yml
2020-07-18 15:44:46 +02:00

90 lines
2.8 KiB
YAML

name: build
on:
schedule:
- cron: "0 12 * * *"
push:
paths-ignore:
- "*.md"
- "*.txt"
- "*.png"
pull_request:
paths-ignore:
- "*.md"
- "*.txt"
- "*.png"
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
- name: Build debian image
run: |
docker build . \
--pull=true \
--file=Dockerfile \
--tag="$IMAGE_NAME:latest" \
--tag="$IMAGE_NAME:debian" \
--tag="$IMAGE_NAME:debian-$GITHUB_SHA" \
--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" \
--tag="$IMAGE_NAME:alpine-$GITHUB_SHA" \
--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: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore: tests/shunit2
- name: Verify signature
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: atmoz/git-verify-ref@master
with:
public_key_dir: ./github/public-keys
- name: Push images to Docker Hub registry
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login \
-u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
docker push $IMAGE_NAME # no tags specified to include all tags
- name: Push images to GitHub registry
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
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