Create Release #11
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: Create Release | |
on: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '6.x' | |
- name: Run gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
id: gitversion | |
- name: Create release | |
run: | | |
set -e | |
gh release create "${{ steps.gitversion.outputs.fullSemVer }}" -t "${{ steps.gitversion.outputs.fullSemVer }}" --generate-notes | |
git push origin --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
INPUT_TAG: ${{ steps.gitversion.outputs.tag }} | |
- name: Log in to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Get quay.io credentials | |
run: | | |
USERNAME=$(az keyvault secret show --name quay-username --vault-name "${{ secrets.AZURE_KEYVAULT_NAME }}" --query value -o tsv) | |
PASSWORD=$(az keyvault secret show --name quay-password --vault-name "${{ secrets.AZURE_KEYVAULT_NAME }}" --query value -o tsv) | |
echo "DOCKER_USERNAME=$USERNAME" >> $GITHUB_ENV | |
echo "DOCKER_PASSWORD=$PASSWORD" >> $GITHUB_ENV | |
echo "::add-mask::$USERNAME" | |
echo "::add-mask::$PASSWORD" | |
- name: Docker login to Quay | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ env.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
quay.io/edward_cooke/vecc.k8s.multiclusteringress | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=semver,pattern={{raw}},value=${{ steps.gitversion.outputs.fullSemVer }} | |
type=semver,pattern={{major}}.{{minor}},value=${{steps.gitversion.outputs.fullSemVer}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=semver,pattern={{major}},value=${{steps.gitversion.outputs.fullSemVer}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |