diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..65d2b00 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release +on: + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare git + run: | + git config --global user.email "gitea@bjornp.com" + git config --global user.name "gitea-actions" + + - name: Determine release version and changelog + run: npx commit-and-tag-version + + - name: Build release + working-directory: src + run: | + VERSION=$(jq '.version' info.json | xargs echo -n) + zip -r ../prometheus-exporter_$VERSION.zip . + + - name: Push changelog and tag + run: git push --follow-tags + + - name: Get latest tag and changelog fragment + id: tag + run: | + echo tag="$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + echo "changelog<> $GITHUB_OUTPUT + awk '/^## / { if (version_found) exit; version_found=1 } version_found { print }' CHANGELOG.md | sed '1d' >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create release + uses: akkuman/gitea-release-action@v1 + with: + files: prometheus-exporter_*.zip + body: ${{ steps.tag.outputs.changelog }} + name: ${{ steps.tag.outputs.tag }} + tag_name: ${{ steps.tag.outputs.tag }} + md5sum: true diff --git a/.versionrc.json b/.versionrc.json new file mode 100644 index 0000000..c86e610 --- /dev/null +++ b/.versionrc.json @@ -0,0 +1,14 @@ +{ + "packageFiles": [ + { + "filename": "src/info.json", + "type": "json" + } + ], + "bumpFiles": [ + { + "filename": "src/info.json", + "type": "json" + } + ] +} \ No newline at end of file diff --git a/src/info.json b/src/info.json index fb5d20f..ba9be30 100644 --- a/src/info.json +++ b/src/info.json @@ -1,9 +1,11 @@ { - "name": "prometheus-exporter", - "version": "0.0.1", - "title": "Prometheus Exporter for Factorio", - "author": "Bjorn Pijnacker", - "factorio_version": "2.0", - "dependencies": ["base >= 2.0"], - "description": "Exports certain production and consumption metrics to Prometheus format, to be used by Prometheus/Grafana monitoring stack" + "name": "prometheus-exporter", + "version": "0.0.1", + "title": "Prometheus Exporter for Factorio", + "author": "Bjorn Pijnacker", + "factorio_version": "2.0", + "dependencies": [ + "base >= 2.0" + ], + "description": "Exports certain production and consumption metrics to Prometheus format, to be used by Prometheus/Grafana monitoring stack" } \ No newline at end of file