name: Publish Dependencies to Docker hub on: push: tags: - v* paths-ignore: - '**.md' - diagrams/* - docs/* schedule: # Weekly build - cron: '0 0 * * 0' jobs: ## Publish to Docker hub publish: name: Publishing runs-on: ubuntu-latest container: image: docker:git steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.4.1 with: access_token: ${{ github.token }} - name: Checkout sources & submodules uses: actions/checkout@v2 with: fetch-depth: 5 submodules: recursive - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Prepare id: prep run: | DOCKER_IMAGE=paritytech/bridge-dependencies VERSION=latest if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} elif [[ $GITHUB_REF == refs/heads/* ]]; then VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') fi TAGS=${DOCKER_IMAGE}:${VERSION} TAGS=$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8} echo ::set-output name=TAGS::${TAGS} echo ::set-output name=DATE::$(date +%d-%m-%Y) - name: Build and push uses: docker/build-push-action@v2 with: file: deployments/BridgeDeps.Dockerfile push: true cache-from: type=registry,ref=paritytech/bridge-dependencies:latest cache-to: type=inline tags: ${{ steps.prep.outputs.TAGS }} labels: | org.opencontainers.image.title=bridge-dependencies org.opencontainers.image.description=bridge-dependencies - component of Parity Bridges Common org.opencontainers.image.source=${{ github.event.repository.html_url }} org.opencontainers.image.url=https://github.com/paritytech/parity-bridges-common org.opencontainers.image.documentation=https://github.com/paritytech/parity-bridges-common/README.md org.opencontainers.image.created=${{ steps.prep.outputs.DATE }} org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.authors=devops-team@parity.io org.opencontainers.image.vendor=Parity Technologies org.opencontainers.image.licenses=GPL-3.0 License