I run tests on GitHub Actions, like this:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.16.1
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build with Maven
run: mvn -B package --file pom.xml
The version of ElasticSearch is currently fixed; but in my project I include the ElasticSearch client 7.16.3. I would like to use that version in the stack-version
as well. Is there a preferred way to extract a property from the pom.xml
and use that in the Action?
You can use get-xml-info to read a property from the pom.xml
- name: Get elasticsearch version from pom.xml
id: get-elasticsearch-version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: 'pom.xml'
xpath: '//*[local-name()="elasticsearch.version.property.tagname"]'
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ steps.get-elasticsearch-version.outputs.info }}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.