Reputation: 322
I am trying to add tags to all commits that pass checks. I started with a template that includes the tests.
Everything runs as expected, however, when I check the tags, it does not show any were added.
Here is my full build.yml
:
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.
name: build
on:
pull_request:
branches: ['*']
push:
branches: ['master']
jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
1.8, # Minimum supported by Minecraft
11, # Current Java LTS
15 # Latest version
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: bump version and push tag
id: tag_version
if: ${{ github.event_name == 'push' && runner.os == 'Linux' && matrix.java == '11' }}
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
create_annotated_tag: true
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
And here are my actions run: https://github.com/cloewen8/Corntopia/actions
I have been working on getting this working for the past hour. I tried moving the "bump version and push tag" task from the end to right after checkout, adding and removing the id, changing were github_token
is defined, making the tag annotated, tried the previous release of the task, using the tag in a release (said new_tag was not defined), even following the example provided for the task exactly.
Am I doing anything wrong? Anything else I should try?
Upvotes: 0
Views: 2671
Reputation: 40613
It looks like it is the issue with action itself. Because it doesn't create a tag properly.
I got it (almost) working with this
- name: Bump version and push tag
if: ${{ github.event_name == 'push' && runner.os == 'Linux' && matrix.java == '11' }}
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
Is master a match for main
pre_release = true
From https://github.com/kmadof/github-actions-manual
* [new branch] kmadof-patch-1 -> origin/kmadof-patch-1
* [new branch] test -> origin/test
* [new tag] v1.4 -> v1.4
* [new tag] v1.5 -> v1.5
* [new tag] v1.6 -> v1.6
* [new tag] v1.7 -> v1.7
* [new tag] v1.8 -> v1.8
* [new tag] v1.9 -> v1.9
* [new tag] v1.91 -> v1.91
* [new tag] v1.92 -> v1.92
* [new tag] v1.93 -> v1.93
* [new tag] v1.94 -> v1.94
fatal: ambiguous argument '0.0.0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
[main] Modified SO workflow [skip ci]
minor
v0.1.0-3ef4b69
This branch is not a release branch. Skipping the tag creation.
But this is rather to a mess which I have in this repo :)
To sum up, please try with anothrNick/[email protected]
and report an issue for mathieudutour/[email protected]
Upvotes: 1