0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-24 12:59:24 -05:00
atmoz-sftp/.github/workflows/build.yml

87 lines
2.6 KiB
YAML
Raw Normal View History

name: build
on:
schedule:
- cron: "0 12 * * *"
push:
2020-07-17 12:21:44 -04:00
paths-ignore:
- "*.md"
- "*.txt"
- "*.png"
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
- 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" \
--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
- name: Push images to Docker Hub registry
2020-07-19 16:12:23 -04:00
if: github.ref == 'refs/heads/master'
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
- name: Push images to GitHub registry
2020-07-19 16:12:23 -04:00
if: 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
2020-07-19 17:02:07 -04:00
docker logout docker.pkg.github.com