Rewrite docker worklfow to use action for json

Use microsoft/variable-substitution instead of manual jq manipulation
pull/7734/head
Christoph Kepler 4 years ago
parent c65ac0dada
commit 21c65bd5db
No known key found for this signature in database
GPG Key ID: FED133CE3670330D

@ -70,29 +70,31 @@ jobs:
tags: | tags: |
type=sha,prefix= type=sha,prefix=
- name: Disable dev flag - name: Rewrite entries in package.json to repository
if: startsWith(github.ref, 'refs/tags/v') uses: microsoft/variable-substitution@v1
run: | with:
sudo apt-get install jq -y files: "package.json"
mv package.json pkg-temp.json env:
jq -r '.dev |= false' pkg-temp.json > package.json repository.url: "git+${{ github.server_url }}/${{ github.repository }}.git"
rm pkg-temp.json bugs.url: "${{ github.server_url }}/${{ github.repository }}/issues"
homepage: "${{ github.server_url }}/${{ github.repository }}#readme"
- name: Set Package Version (tag) - name: Disable dev flag and set package version (tag)
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
run: | uses: microsoft/variable-substitution@v1
mv package.json pkg-temp.json with:
jq -r '.version |= "${{ steps.meta_tag.outputs.version }}"' pkg-temp.json > package.json files: "package.json"
rm pkg-temp.json env:
cat package.json dev: "false"
version: ${{ steps.meta_tag.outputs.version }}
- name: Set Package Version (bleeding) - name: Set package version (bleeding)
if: false == startsWith(github.ref, 'refs/tags/v') if: false == startsWith(github.ref, 'refs/tags/v')
run: | uses: microsoft/variable-substitution@v1
mv package.json pkg-temp.json with:
jq -r '.version |= "${{ steps.meta_bleeding.outputs.version }}"' pkg-temp.json > package.json files: "package.json"
rm pkg-temp.json env:
cat package.json version: ${{ steps.meta_bleeding.outputs.version }}
- name: Build and push Docker image (tag) - name: Build and push Docker image (tag)
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')

Loading…
Cancel
Save