mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-24 12:59:24 -05:00
86 lines
2.7 KiB
YAML
86 lines
2.7 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:debian" \
|
|
--tag="$IMAGE_NAME:latest" \
|
|
--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: 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: ./.github/actions/git-verify-ref
|
|
|
|
- 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
|
|
|