v1.7.6: add a load_content option for some workflows where being able… #181
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Building, Testing, and Pushing Archivy Container Image On Push and PRs To Master Branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'archivy/**' | |
- '.github/workflows/build-docker-on-push-master.yml' | |
jobs: | |
dockerBuildPush: | |
name: Build and push image with release version tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout files from repository | |
uses: actions/checkout@v2 | |
with: | |
repository: archivy/archivy-docker | |
- name: Setting variables | |
if: success() | |
run: | | |
date -u +'%Y-%m-%dT%H:%M:%SZ' > TIMESTAMP | |
echo "${GITHUB_SHA}" | cut -c1-8 > SHORT_SHA | |
echo "source" > IMAGE_TAG | |
echo "uzayg" > DOCKER_USERNAME | |
echo "docker.io/uzayg/archivy" > DOCKER_IMAGE | |
- name: Set up Docker Buildx | |
if: success() | |
uses: docker/setup-buildx-action@v1.0.2 | |
with: | |
install: true | |
version: latest | |
- name: Docker login | |
if: success() | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
run: | | |
echo "${DOCKER_PASSWORD}" | docker login --username "$( cat DOCKER_USERNAME )" --password-stdin docker.io | |
# Build and push images with the tags | |
# source | |
# hash - Commit hash(first 8 characters) | |
- name: Build and push with Docker Buildx | |
if: success() | |
run: | | |
docker build \ | |
--output type=image,name="$(cat DOCKER_IMAGE)",push=true \ | |
--build-arg BUILD_DATE="$( cat TIMESTAMP )" --build-arg VCS_REF="$( cat SHORT_SHA )" \ | |
--tag "$( cat DOCKER_IMAGE ):$( cat IMAGE_TAG )" \ | |
--file ./Dockerfile.source . |