Fix create_release.yml #6
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: Upload the latest release | |
on: | |
push: | |
tags: [ "v*" ] | |
jobs: | |
create: | |
name: "Creates the newest release by version" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout project | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Set up Docker Build | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get version from tag | |
id: get_version | |
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" | |
- name: Update package.json version | |
run: | | |
jq ".version = \"${{ steps.get_version.outputs.version }}\"" package.json > tmp.json | |
mv tmp.json package.json | |
- name: Check if there are changes to commit | |
id: check_changes | |
run: | | |
git add package.json | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit." | |
echo "::set-output name=changes::false" | |
else | |
echo "::set-output name=changes::true" | |
fi | |
- name: Commit version change to main | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
git commit -m "Update version to ${{ steps.get_version.outputs.version }}" | |
git push origin HEAD:main | |
- name: Create GitHub Release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
title: Release ${{ steps.get_version.outputs.version }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
tags: | | |
germannewsmaker/nexterm:latest | |
germannewsmaker/nexterm:${{ steps.get_version.outputs.version }} |