|
95 | 95 | git add *.{html,json} |
96 | 96 | git commit -m "publish Autobahn|Testsuite report" || true |
97 | 97 | git push |
98 | | -
|
99 | | - publish-hex-package: |
100 | | - name: Publish Hex Package ⬆️☁️ |
101 | | - runs-on: ubuntu-latest |
102 | | - if: startsWith(github.ref, 'refs/tags/v') |
103 | | - env: |
104 | | - MIX_ENV: dev |
105 | | - needs: |
106 | | - - bless |
107 | | - |
108 | | - steps: |
109 | | - - name: Checkout |
110 | | - uses: actions/checkout@v2 |
111 | | - |
112 | | - - name: Determine the elixir version |
113 | | - run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV |
114 | | - |
115 | | - - name: Determine the otp version |
116 | | - run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV |
117 | | - |
118 | | - - name: Setup Elixir and Erlang versions |
119 | | - |
120 | | - with: |
121 | | - otp-version: ${{ env.OTP_VERSION }} |
122 | | - elixir-version: ${{ env.ELIXIR_VERSION }} |
123 | | - |
124 | | - - name: Restore the deps cache |
125 | | - uses: actions/cache@v1 |
126 | | - id: deps-cache |
127 | | - with: |
128 | | - path: deps |
129 | | - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} |
130 | | - restore-keys: | |
131 | | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps- |
132 | | -
|
133 | | - - name: Restore the _build cache |
134 | | - uses: actions/cache@v1 |
135 | | - id: build-cache |
136 | | - with: |
137 | | - path: _build |
138 | | - key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} |
139 | | - restore-keys: | |
140 | | - ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-build- |
141 | | -
|
142 | | - - name: Fetch mix dependencies |
143 | | - if: steps.deps-cache.outputs.cache-hit != 'true' |
144 | | - run: | |
145 | | - mix local.rebar --force |
146 | | - mix local.hex --force |
147 | | - mix deps.get |
148 | | -
|
149 | | - - name: Compile dependencies |
150 | | - if: steps.deps-cache.outputs.cache-hit != 'true' |
151 | | - run: mix deps.compile |
152 | | - |
153 | | - - name: Generate documentation |
154 | | - run: mix docs |
155 | | - |
156 | | - - name: Determine the tag version |
157 | | - env: |
158 | | - GITHUB_REF: ${{ github.ref }} |
159 | | - run: echo "TAG=$(echo "$GITHUB_REF" | awk -F / '{print $3}')" >> $GITHUB_ENV |
160 | | - |
161 | | - - name: Write the tag version to .version |
162 | | - run: echo $TAG > .version |
163 | | - |
164 | | - - name: Determine the repository name |
165 | | - run: echo "REPOSITORY=$(echo $GITHUB_REPOSITORY | awk -F / '{print $2}')" >> $GITHUB_ENV |
166 | | - |
167 | | - - name: Create a GitHub Release |
168 | | - id: create_release |
169 | | - uses: NFIBrokerage/create-release@v2 |
170 | | - env: |
171 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
172 | | - with: |
173 | | - tag_name: ${{ env.TAG }} |
174 | | - release_name: Release ${{ env.TAG }} |
175 | | - draft: false |
176 | | - prerelease: false |
177 | | - |
178 | | - - name: Publish library |
179 | | - run: mix hex.publish --yes |
180 | | - env: |
181 | | - HEX_API_KEY: ${{ secrets.HEX_PUBLISH_KEY }} |
182 | | - |
183 | | - - name: Notify ops channel of build success |
184 | | - run: > |
185 | | - curl |
186 | | - -X POST |
187 | | - -H 'Content-type:application/json' |
188 | | - -d "{\"text\":\":hexpm: package published for $REPOSITORY $(git tag -ln $TAG)\"}" |
189 | | - $SLACK_WEBHOOK |
190 | | - env: |
191 | | - SLACK_WEBHOOK: ${{ secrets.OPS_CHANNEL_SLACK_WEBHOOK }} |
0 commit comments