Skip to content

Commit

Permalink
Created Simplified Docker Publish yml file (#30)
Browse files Browse the repository at this point in the history
* Added simplified docker publish, added Google Analytics plugin

* Increased the version to 1.0.6

---------

Co-authored-by: Martin-Belton-gov <martin.belton@digital.education.gov.uk>
  • Loading branch information
MartinBelton-gov and Martin-Belton-gov authored Jan 18, 2024
1 parent e1ae82a commit 8da9519
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dockerpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ jobs:
run: |
mkdir latest-cost-plugin
cd /home/runner/work/Grafana.Plugin.CostManagement/Grafana.Plugin.CostManagement/latest-cost-plugin
wget "https://github.com/${{ github.repository }}/releases/download/main/dfe-azurecostbackend-datasource-1.0.5.zip"
wget "https://github.com/${{ github.repository }}/releases/download/main/dfe-azurecostbackend-datasource-1.0.6.zip"
wget "https://grafana.com/api/plugins/blackcowmoo-googleanalytics-datasource/versions/0.2.3/download"
- name: Unzip Plugin
run: |
cd /home/runner/work/Grafana.Plugin.CostManagement/Grafana.Plugin.CostManagement/latest-cost-plugin
unzip -o dfe-azurecostbackend-datasource-1.0.5.zip
unzip -o dfe-azurecostbackend-datasource-1.0.6.zip
unzip -o blackcowmoo-googleanalytics-datasource-0.2.3.zip
cd /home/runner/work/Grafana.Plugin.CostManagement/Grafana.Plugin.CostManagement/latest-cost-plugin/dfe-azurecostbackend-datasource
pwd
ls
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Push Grafana Docker Image

on:
workflow_dispatch:
release:
types: [published]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download Grafana Plugin
run: |
mkdir -p grafana-cost-plugin
cd grafana-cost-plugin
wget "https://github.com/DFE-Digital/Grafana.Plugin.CostManagement/releases/download/main/dfe-azurecostbackend-datasource-1.0.6.zip"
wget "https://grafana.com/api/plugins/blackcowmoo-googleanalytics-datasource/versions/0.2.3/download"
unzip -o dfe-azurecostbackend-datasource-1.0.6.zip
unzip -o blackcowmoo-googleanalytics-datasource-0.2.3.zip
cd ..
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker Image
run: |
docker build -t ${{ env.REGISTRY }}/DFE-Digital/Grafana.Plugin.CostManagement-azurecost:latest
docker push ${{ env.REGISTRY }}/DFE-Digital/Grafana.Plugin.CostManagement-azurecost:latest
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_ACI: 1

4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ USER root

# Copy your plugin files into the Grafana plugins directory
COPY latest-cost-plugin/dfe-azurecostbackend-datasource /var/lib/grafana/plugins/dfe-azurecostbackend-datasource
COPY latest-cost-plugin/blackcowmoo-googleanalytics-datasource /var/lib/grafana/plugins/blackcowmoo-googleanalytics-datasource

# Set permissions for the plugin directory
RUN chown -R 472:472 /var/lib/grafana/plugins/dfe-azurecostbackend-datasource
RUN chown -R 472:472 /var/lib/grafana/plugins/dfe-azurecostbackend-datasource
RUN chown -R 472:472 /var/lib/grafana/plugins/blackcowmoo-googleanalytics-datasource
2 changes: 1 addition & 1 deletion dfe-azurecostbackend-datasource/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "1",
"name": "azurecost-backend",
"version": "1.0.5",
"version": "1.0.6",
"description": "Azure cost backend",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand Down

0 comments on commit 8da9519

Please sign in to comment.