chore(release): 3.3.2 #2
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
name: release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]' | |
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' | |
jobs: | |
build-plugin-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Install go dependencies | |
run: make install-go-dependencies | |
- name: build all versions | |
run: make build-backend-all | |
- name: Upload linux binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: plugin-executables | |
path: ./dist/ | |
create-artifacts: | |
runs-on: ubuntu-latest | |
needs: | |
- build-plugin-backend | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get metadata about the plugin | |
id: metadata | |
run: | | |
export PLUGIN_VERSION=${GITHUB_REF#refs/tags/v} | |
export PLUGIN_ARTIFACT=frser-sqlite-datasource-${PLUGIN_VERSION}.zip | |
echo "version=${PLUGIN_VERSION}" >> $GITHUB_OUTPUT | |
echo "archive=${PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT | |
export TAG_WITHOUT_RC=$(echo ${PLUGIN_VERSION} | sed -r s/-rc\.[0-9]+//) | |
echo "versionWithoutRc=${TAG_WITHOUT_RC}" >> $GITHUB_OUTPUT | |
- name: Check changelog | |
run: | | |
if ! grep -q -F "## [${{ steps.metadata.outputs.versionWithoutRc }}]" CHANGELOG.md; then | |
echo "Error: The (## [${{ steps.metadata.outputs.versionWithoutRc }}]) tag was not found in the CHANGELOG.md." | |
echo "Latest tag: ${{ steps.metadata.outputs.version }}" 1>&2 | |
exit 1 | |
fi | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.20.x | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-node-modules- | |
${{ runner.OS }}- | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Download plugin backend | |
uses: actions/download-artifact@v3 | |
with: | |
name: plugin-executables | |
path: ./dist/ | |
- name: Build frontend | |
run: | | |
make build-frontend | |
- name: package-and-zip | |
env: | |
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} | |
run: make package-and-zip PLUGIN_VERSION=${{ steps.metadata.outputs.version }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Lint plugin | |
# the rc part of the version is rejected by the plugin validator | |
# do not provide a source code URI as the source code check fails due to: | |
# "error: It is not permitted to access the file system."" | |
if: ${{ !steps.check_prerelease.outputs.is_prerelease }} | |
run: | | |
docker run --pull=always -v ${PWD}/:/the_app grafana/plugin-validator-cli | |
/the_app/${{ steps.metadata.outputs.archive }} | |
# -sourceCodeUri file:///the_app /the_app/${{ steps.metadata.outputs.archive }} | |
- name: Upload plugin package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: plugin-package | |
path: ${{ steps.metadata.outputs.archive }} | |
# testing on macos and windows is currently not done as docker is not available on the runners | |
test-selenium-release-linux: | |
runs-on: ubuntu-latest | |
needs: | |
- create-artifacts | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get metadata about the plugin | |
id: metadata | |
run: | | |
export PLUGIN_VERSION=${GITHUB_REF#refs/tags/v} | |
export PLUGIN_ARTIFACT=frser-sqlite-datasource-${PLUGIN_VERSION}.zip | |
echo "version=${PLUGIN_VERSION}" >> $GITHUB_OUTPUT | |
echo "archive=${PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT | |
- name: Download plugin package | |
uses: actions/download-artifact@v3 | |
with: | |
name: plugin-package | |
path: ./ | |
- name: unzip plugin | |
run: unzip ${{ steps.metadata.outputs.archive }} && mv frser-sqlite-datasource dist | |
- name: update Grafana config to production values | |
run: | | |
sed -i 's/allow_loading_unsigned_plugins = true//g' grafana_config/grafana.ini | |
sed -i 's/app_mode = development/app_mode = production/g' grafana_config/grafana.ini | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.20.x | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-node-modules- | |
${{ runner.OS }}- | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Run Selenium Tests | |
env: | |
VERBOSE_TEST_OUTPUT: 1 | |
run: make test-e2e-no-build | |
- name: Debug Logs | |
if: ${{ failure() }} | |
run: docker-compose logs grafana | |
create-release: | |
runs-on: ubuntu-latest | |
needs: | |
- test-selenium-release-linux | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get metadata about the plugin | |
id: metadata | |
run: | | |
export PLUGIN_VERSION=${GITHUB_REF#refs/tags/v} | |
export PLUGIN_ARTIFACT=frser-sqlite-datasource-${PLUGIN_VERSION}.zip | |
echo "version=${PLUGIN_VERSION}" >> $GITHUB_OUTPUT | |
echo "archive=${PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT | |
- name: Download plugin package | |
uses: actions/download-artifact@v3 | |
with: | |
name: plugin-package | |
path: ./ | |
- name: create md5 hash | |
run: | | |
md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive }}.md5 | |
- name: Set release notes | |
id: set_release_notes | |
run: | | |
sed 's/$VERSION/${{ steps.metadata.outputs.version }}/g' release_template.md > release_notes.md | |
awk '/^## / {s++} s == 2 {print}' CHANGELOG.md > changelog_extract.md | |
# skip the first two lines | |
tail -n +3 changelog_extract.md >> release_notes.md | |
echo "path=release_notes.md" >> $GITHUB_OUTPUT | |
- name: Check prerelease | |
id: check_prerelease | |
run: | | |
if [[ ${{ github.ref }} =~ "rc" ]]; then | |
echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: Release ${{ steps.metadata.outputs.version }} | |
body_path: ${{ steps.set_release_notes.outputs.path }} | |
prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }} | |
files: | | |
${{ steps.metadata.outputs.archive }} | |
${{ steps.metadata.outputs.archive }}.md5 |