diff --git a/.github/workflows/create-artefacts.yml b/.github/workflows/create-artefacts.yml index bcd76f2..425b3a1 100644 --- a/.github/workflows/create-artefacts.yml +++ b/.github/workflows/create-artefacts.yml @@ -1,34 +1,41 @@ -name: Create Artefacts +name: Create artifacts -on: [pull_request] +on: [pull_request, push] jobs: - create-artefacts: + create-artifacts: runs-on: ubuntu-latest - name: Create artefact + name: Create artifact + env: + tag: v3.0.0 steps: + - run: echo $tag - uses: actions/checkout@v3 - run: mkdir -p path/to/artifact - - run: echo ${{github.sha}} > path/to/artifact/world.txt + - run: echo $tag > path/to/artifact/artifact1-$tag.txt + - run: echo $tag > path/to/artifact/artifact2-$tag.txt + - run: ls -al path/to/artifact - uses: actions/upload-artifact@v3 with: - name: my-artifact - path: path/to/artifact/world.txt + name: my-artifact-${{env.tag}} + path: path/to/artifact/ - test-artefact: - name: Test artefacts + test-artifact: + name: Test artifacts runs-on: ubuntu-latest - needs: [create-artefacts] + needs: [create-artifacts] + env: + tag: v3.0.0 steps: - uses: actions/download-artifact@v3 with: - name: my-artifact + name: my-artifact-${{env.tag}} path: path/to/artifact - name: Display structure of downloaded files run: ls -R working-directory: path/to/artifact - - name: Show text artefact - run: cat world.txt + - name: Show text artifact + run: cat artifact1-${{env.tag}}.txt working-directory: path/to/artifact diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c14a416..81401d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,16 +4,18 @@ on: push: branches: - main +env: + tag: v3.0.0 jobs: release: name: Release runs-on: ubuntu-latest env: - tag: v1.2.9 + tag: v3.0.0 steps: - uses: actions/checkout@v3 - # Do not have access to other WF artefacts + # Do not have access to other WF artifacts # - uses: actions/download-artifact@v3 # with: # name: my-artifact @@ -23,8 +25,8 @@ jobs: # working-directory: dist - run: mkdir -p dist - run: echo $ART_VERSION - - name: Download artefacts - run: gh run download -n my-artifact + - name: Download artifacts + run: gh run download -n my-artifact-${{env.tag}} working-directory: dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -42,9 +44,8 @@ jobs: - name: Release by softprops uses: softprops/action-gh-release@v1 with: - files: ./dist/world.txt - tag_name: v1.2.9 - + files: ./dist/* + tag_name: $tag # - name: Release # run: gh release create v1.2.3 ./dist/* diff --git a/package.json b/package.json new file mode 100644 index 0000000..db4fb1c --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "github-action-tests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/BSekula/github-actions-test.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/BSekula/github-actions-test/issues" + }, + "homepage": "https://github.com/BSekula/github-actions-test#readme" +}