release #18
Workflow file for this run
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
# Copyright 2021-2023 D2iQ, Inc. All rights reserved. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- v* | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
release-tag: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Set up devenv.sh environment | |
uses: d2iq-labs/devenv.sh-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
run: make release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Update released plugin version in plugin.yaml | |
run: yq -i '.version |= ("${{ github.ref_name }}" | sub("^v";""))' plugin.yaml | |
# Use the REST API to update plugin.yaml, so we get automatic commit signing. | |
- name: Commit changes to plugin.yaml via REST API | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FILE_TO_COMMIT: plugin.yaml | |
DESTINATION_BRANCH: main | |
run: | | |
export MESSAGE="build: Update plugin.yaml to version ${{ github.ref_name }}" | |
export SHA="$( git rev-parse ${DESTINATION_BRANCH}:${FILE_TO_COMMIT} )" | |
export CONTENT="$( base64 -i ${FILE_TO_COMMIT} )" | |
gh api --method PUT /repos/:owner/:repo/contents/${FILE_TO_COMMIT} \ | |
--field message="${MESSAGE}" \ | |
--field content="${CONTENT}" \ | |
--field encoding="base64" \ | |
--field branch="${DESTINATION_BRANCH}" \ | |
--field sha="${SHA}" |