Skip to content

Tag and Release

Tag and Release #49

Workflow file for this run

name: Tag and Release
on: workflow_dispatch
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
tag-and-release:
runs-on: ubuntu-latest
permissions: write-all
outputs:
version: ${{ steps.tag.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
- uses: DeLaGuardo/setup-clojure@master
with:
cli: latest
- name: Show versions
run: |
java -version
clojure --version
- uses: actions/cache@v4
with:
path: ~/.m2
key: test-m2-${{ hashFiles('deps.edn') }}-v1
- id: tag
run: |
clojure -T:build update-documents
git diff
git config --global user.email "github-actions@example.com"
git config --global user.name "github-actions"
git add -A
git commit -m "Update for release" || exit 0
git push
- name: deploy to clojars
run: clojure -T:build deploy :version '"${{ steps.tag.outputs.version }}"'
env:
CLOJARS_PASSWORD: ${{secrets.CLOJARS_PASSWORD}}
CLOJARS_USERNAME: ${{secrets.CLOJARS_USERNAME}}
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag.outputs.version }}
skipIfReleaseExists: true
generateReleaseNotes: true
docker-push:
runs-on: ubuntu-latest
needs: tag-and-release
steps:
- uses: actions/checkout@v4
- name: docker login
run: |
echo ${{ secrets.CONTAINER_REGISTRY_TOKEN }} | docker login ${{ env.REGISTRY }} -u $GITHUB_ACTOR --password-stdin
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# FIXME docker build . -t ...:latest -t ...:ref
- name: build latest
run: |
docker build . -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest --cache-from ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: build for tag
run: |
docker build . -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.tag-and-release.outputs.version }} --cache-from ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.tag-and-release.outputs.version }}