|
1 | | -name: build |
| 1 | +name: Build and Release |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | | - paths-ignore: [".gitignore", "**/*.md"] |
5 | | - branches: [master] |
6 | | - tags: ["*"] |
| 5 | + branches: |
| 6 | + - master |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - docker-publish-tags: |
10 | | - if: contains(github.ref, 'refs/tags/v') |
11 | | - runs-on: ubuntu-latest |
12 | | - steps: |
13 | | - - uses: actions/checkout@v2 |
14 | | - - uses: elgohr/Publish-Docker-Github-Action@master |
15 | | - with: |
16 | | - name: fmcore/coreapi |
17 | | - username: ${{ secrets.DOCKER_USERNAME }} |
18 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
19 | | - tag_semver: true |
20 | | - docker-publish-latest: |
21 | | - if: github.ref == 'refs/heads/master' |
| 9 | + build: |
22 | 10 | runs-on: ubuntu-latest |
| 11 | + |
23 | 12 | steps: |
24 | | - - uses: actions/checkout@v2 |
25 | | - - uses: elgohr/Publish-Docker-Github-Action@master |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - name: Build Docker image |
| 17 | + run: | |
| 18 | + docker build -t myapp . |
| 19 | +
|
| 20 | + - name: Create container and extract |
| 21 | + run: | |
| 22 | + mkdir -p ./app |
| 23 | + docker create --name extract myapp |
| 24 | + docker cp extract:/app/coreapi ./app/coreapi |
| 25 | + docker cp extract:/app/cc ./app/cc |
| 26 | + docker rm extract |
| 27 | + - name: Archive release |
| 28 | + run: tar -czvf output.tar.gz ./app |
| 29 | + |
| 30 | + - name: Create Release |
| 31 | + id: create_release |
| 32 | + uses: softprops/action-gh-release@v1 |
26 | 33 | with: |
27 | | - name: fmcore/coreapi |
28 | | - username: ${{ secrets.DOCKER_USERNAME }} |
29 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
30 | | - post-to-webhook: |
31 | | - needs: [docker-publish-latest] |
32 | | - runs-on: ubuntu-latest |
33 | | - steps: |
34 | | - - run: | |
35 | | - set +x |
36 | | - curl -XPOST -H 'X-Webhook-Auth: ${{ secrets.WEBHOOK_SECRET }}' -H "Content-type: application/json" -d '{"app": "flagbrew", "service": "coreapi"}' '${{ secrets.WEBHOOK_URL }}' |
| 34 | + tag_name: run-${{ github.run_number }}-${{ github.sha }} |
| 35 | + name: Build ${{ github.sha }} |
| 36 | + draft: false |
| 37 | + prerelease: false |
| 38 | + files: output.tar.gz |
0 commit comments